[Rt-commit] rt branch, 4.2/single-role-group-resolve, created. rt-4.2.2-10-ga407006

Alex Vandiver alexmv at bestpractical.com
Tue Jan 28 18:37:09 EST 2014


The branch, 4.2/single-role-group-resolve has been created
        at  a4070069ae2d21302e0dd1ec9c54e29c7ebdc97f (commit)

- Log -----------------------------------------------------------------
commit 07dab422cf5081ce970cf3cfcbfd461926d02349
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 28 18:35:52 2014 -0500

    $user->PrincipalObj is _undef_ if the LoadByEmail failed
    
    This prevents runtime errors when assigning unknown users as
    single-member roles

diff --git a/lib/RT/Record/Role/Roles.pm b/lib/RT/Record/Role/Roles.pm
index aad2673..5c78f51 100644
--- a/lib/RT/Record/Role/Roles.pm
+++ b/lib/RT/Record/Role/Roles.pm
@@ -524,9 +524,9 @@ sub _ResolveRoles {
                 $user->LoadByEmail( $value ) unless $user->id;
                 $roles->{$role} = $user->PrincipalObj;
             }
-            unless ($roles->{$role}->id) {
+            unless ($roles->{$role} and $roles->{$role}->id) {
                 push @errors, $self->loc("Invalid value for [_1]",loc($role));
-                $roles->{$role} = RT->Nobody->PrincipalObj unless $roles->{$role}->id;
+                $roles->{$role} = RT->Nobody->PrincipalObj;
             }
             # For consistency, we always return an arrayref
             $roles->{$role} = [ $roles->{$role} ];

commit a4070069ae2d21302e0dd1ec9c54e29c7ebdc97f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jan 28 18:36:19 2014 -0500

    loc() is only in scope by way of $self->

diff --git a/lib/RT/Record/Role/Roles.pm b/lib/RT/Record/Role/Roles.pm
index 5c78f51..a6172b4 100644
--- a/lib/RT/Record/Role/Roles.pm
+++ b/lib/RT/Record/Role/Roles.pm
@@ -525,7 +525,7 @@ sub _ResolveRoles {
                 $roles->{$role} = $user->PrincipalObj;
             }
             unless ($roles->{$role} and $roles->{$role}->id) {
-                push @errors, $self->loc("Invalid value for [_1]",loc($role));
+                push @errors, $self->loc("Invalid value for [_1]",$self->loc($role));
                 $roles->{$role} = RT->Nobody->PrincipalObj;
             }
             # For consistency, we always return an arrayref

-----------------------------------------------------------------------


More information about the rt-commit mailing list