[Rt-commit] r4059 - in rt/branches/3.4-RELEASE: . lib/RT

jesse at bestpractical.com jesse at bestpractical.com
Fri Nov 11 00:12:50 EST 2005


Author: jesse
Date: Fri Nov 11 00:12:49 2005
New Revision: 4059

Modified:
   rt/branches/3.4-RELEASE/   (props changed)
   rt/branches/3.4-RELEASE/lib/RT/Groups_Overlay.pm
Log:
 r18716 at truegrounds:  jesse | 2005-11-11 00:10:08 -0500
 * fix from ruslan for fallout from his WhoHaveRight refactoring


Modified: rt/branches/3.4-RELEASE/lib/RT/Groups_Overlay.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/Groups_Overlay.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/Groups_Overlay.pm	Fri Nov 11 00:12:49 2005
@@ -87,6 +87,24 @@
 
 # {{{ sub _Init
 
+=begin testing
+
+# next had bugs
+# Groups->Limit( FIELD => 'id', OPERATOR => '!=', VALUE => xx );
+my $g = RT::Group->new($RT::SystemUser);
+my ($id, $msg) = $g->CreateUserDefinedGroup(Name => 'GroupsNotEqualTest');
+ok ($id, "created group #". $g->id) or diag("error: $msg");
+
+my $groups = RT::Groups->new($RT::SystemUser);
+$groups->Limit( FIELD => 'id', OPERATOR => '!=', VALUE => $g->id );
+$groups->LimitToUserDefinedGroups();
+my $bug = grep $_->id == $g->id, @{$groups->ItemsArrayRef};
+ok (!$bug, "didn't find group");
+
+=end testing
+
+=cut
+
 sub _Init { 
   my $self = shift;
   $self->{'table'} = "Groups";
@@ -98,13 +116,13 @@
 		  FIELD => 'Name',
 		  ORDER => 'ASC');
 
-  $self->{'princalias'} = $self->NewAlias('Principals');
-
   # XXX: this code should be generalized
-  $self->Join( ALIAS1 => 'main',
-               FIELD1 => 'id',
-               ALIAS2 => $self->{'princalias'},
-               FIELD2 => 'id' );
+  $self->{'princalias'} = $self->Join(
+    ALIAS1 => 'main',
+    FIELD1 => 'id',
+    TABLE2 => 'Principals',
+    FIELD2 => 'id'
+  );
 
   # even if this condition is useless and ids in the Groups table
   # only match principals with type 'Group' this could speed up
@@ -253,7 +271,7 @@
 $u->Create(Name => 'Membertests');
 my $g = RT::Group->new($RT::SystemUser);
 my ($id, $msg) = $g->CreateUserDefinedGroup(Name => 'Membertests');
-ok ($id,$msg);
+ok ($id, $msg);
 
 my ($aid, $amsg) =$g->AddMember($u->id);
 ok ($aid, $amsg);
@@ -265,9 +283,6 @@
 ok ($groups->Count == 1,"found the 1 group - " . $groups->Count);
 ok ($groups->First->Id == $g->Id, "it's the right one");
 
-
-
-
 =end testing
 
 


More information about the Rt-commit mailing list