[Rt-commit] [svn] r939 - in rt/trunk: . lib/RT lib/t/data

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Sun May 23 22:14:26 EDT 2004


Author: jesse
Date: Sun May 23 22:14:26 2004
New Revision: 939

Added:
   rt/trunk/lib/t/data/rt-send-cc
Modified:
   rt/trunk/   (props changed)
   rt/trunk/lib/RT/Groups_Overlay.pm
   rt/trunk/lib/RT/Queue_Overlay.pm
Log:
 ----------------------------------------------------------------------
 r1664 at tinbook:  jesse | 2004-05-24T01:24:50.613317Z
 
 Minor documentation update
 ----------------------------------------------------------------------
 r1665 at tinbook:  jesse | 2004-05-24T01:28:12.674977Z
 
 Fixed a regression related to Groups->WithRight
 ----------------------------------------------------------------------
 r1666 at tinbook:  jesse | 2004-05-24T02:12:25.100951Z
 
 added back a missing test file
 ----------------------------------------------------------------------
 r1667 at tinbook:  jesse | 2004-05-24T02:13:00.285813Z
 
 Altering a Groups join to be a bit more efficient
 ----------------------------------------------------------------------


Modified: rt/trunk/lib/RT/Groups_Overlay.pm
==============================================================================
--- rt/trunk/lib/RT/Groups_Overlay.pm	(original)
+++ rt/trunk/lib/RT/Groups_Overlay.pm	Sun May 23 22:14:26 2004
@@ -229,6 +229,45 @@
 }
 
 
+=head2 WithRight { Right => RIGHTNAME, Object => RT::Record, IncludeSystemRights => 1, IncludeSuperusers => 0 }
+
+
+Find all groups which have RIGHTNAME for RT::Record. Optionally include global rights and superusers. By default, include the global rights, but not the superusers.
+
+=begin testing
+
+my $q = RT::Queue->new($RT::SystemUser);
+my ($id, $msg) =$q->Create( Name => 'GlobalACLTest');
+ok ($id, $msg);
+
+my $testuser = RT::User->new($RT::SystemUser);
+($id,$msg) = $testuser->Create(Name => 'JustAnAdminCc');
+ok ($id,$msg);
+
+my $global_admin_cc = RT::Group->new($RT::SystemUser);
+$global_admin_cc->LoadSystemRoleGroup('AdminCc');
+ok($global_admin_cc->id, "Found the global admincc group");
+my $groups = RT::Groups->new($RT::SystemUser);
+$groups->WithRight(Right => 'OwnTicket', Object => $q);
+is($groups->Count, 1);
+($id, $msg) = $global_admin_cc->PrincipalObj->GrantRight(Right =>'OwnTicket', Object=> $RT::System);
+ok ($id,$msg);
+ok (!$testuser->HasRight(Object => $q, Right => 'OwnTicket') , "The test user does not have the right to own tickets in the test queue");
+($id, $msg) = $q->AddWatcher(Type => 'AdminCc', PrincipalId => $testuser->id);
+ok($id,$msg);
+ok ($testuser->HasRight(Object => $q, Right => 'OwnTicket') , "The test user does have the right to own tickets now. thank god.");
+
+$groups = RT::Groups->new($RT::SystemUser);
+$groups->WithRight(Right => 'OwnTicket', Object => $q);
+ok ($id,$msg);
+is($groups->Count, 2);
+
+=end testing
+
+
+=cut
+
+
 sub WithRight {
     my $self = shift;
     my %args = ( Right                  => undef,
@@ -273,7 +312,7 @@
             $or_check_roles =
                 " OR ( ( (main.Domain = 'RT::Queue-Role' AND main.Instance = " .
                 $args{'Object'}->Id . ") $or_check_ticket_roles ) " .
-                " AND main.Type = $acl.PrincipalType AND main.id = $acl.PrincipalId) ";
+                " AND main.Type = $acl.PrincipalType) ";
         }
 
 	if ( $args{'IncludeSystemRights'} ) {
@@ -317,7 +356,7 @@
 	ALIAS1 => 'main',
 	FIELD1 => 'id',
 	TABLE2 => 'Principals',
-	FIELD2 => 'ObjectId'
+	FIELD2 => 'id'
     );
 
     $self->Limit( ALIAS => $alias,
@@ -343,7 +382,7 @@
 	ALIAS1 => 'main',
 	FIELD1 => 'id',
 	TABLE2 => 'Principals',
-	FIELD2 => 'ObjectId'
+	FIELD2 => 'id'
     );
 
     $self->{'find_disabled_rows'} = 1;

Modified: rt/trunk/lib/RT/Queue_Overlay.pm
==============================================================================
--- rt/trunk/lib/RT/Queue_Overlay.pm	(original)
+++ rt/trunk/lib/RT/Queue_Overlay.pm	Sun May 23 22:14:26 2004
@@ -519,6 +519,8 @@
 
 If the watcher you\'re trying to set has an RT account, set the Owner paremeter to their User Id. Otherwise, set the Email parameter to their Email address.
 
+Returns a tuple of (status/id, message).
+
 =cut
 
 sub AddWatcher {

Added: rt/trunk/lib/t/data/rt-send-cc
==============================================================================
--- (empty file)
+++ rt/trunk/lib/t/data/rt-send-cc	Sun May 23 22:14:26 2004
@@ -0,0 +1,5 @@
+From: rt at example.com
+subject: testing send-cc headers
+RT-Send-Cc: this-is-a-sample-test1e at example.com, second-this-is-a-sample-test2 at example.com,  test-sample-sample-sample-test3 at example.com,
+    afourthtest4 at example.com,
+ test5 at example.com


More information about the Rt-commit mailing list