[Rt-commit] r8768 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Tue Aug 28 14:38:31 EDT 2007


Author: ruz
Date: Tue Aug 28 14:38:31 2007
New Revision: 8768

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm

Log:
 r8656 at cubic-pc (orig r8655):  ruz | 2007-08-21 03:51:34 +0400
 * allow test writers to pass an object that has PrincipalObj method,
   such as user or group, instead of forcing them to type each time.
   Care over developers suffering from wrists injuries.


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm	Tue Aug 28 14:38:31 2007
@@ -287,6 +287,11 @@
 
     foreach my $e (@list) {
         my $principal = delete $e->{'Principal'};
+        unless ( $principal->isa('RT::Principal') ) {
+            if ( $principal->can('PrincipalObj') ) {
+                $principal = $principal->PrincipalObj;
+            }
+        }
         my @rights = ref $e->{'Right'}? @{ $e->{'Right'} }: ($e->{'Right'});
         foreach my $right ( @rights ) {
             my ($status, $msg) = $principal->GrantRight( %$e, Right => $right );


More information about the Rt-commit mailing list