[Rt-commit] rt branch, 3.8/fix-users-whohaveroleright, created. rt-3.8.9-14-gd40bcaa

Thomas Sibley trs at bestpractical.com
Fri Mar 4 16:46:12 EST 2011


The branch, 3.8/fix-users-whohaveroleright has been created
        at  d40bcaae54f2f409c48f62e31e14ff7121064ce4 (commit)

- Log -----------------------------------------------------------------
commit d40bcaae54f2f409c48f62e31e14ff7121064ce4
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Mar 4 16:44:57 2011 -0500

    Users->WhoHaveRoleRight wasn't actually limiting to any objects
    
    RT::Principal->RolesWithRight only expects EquivObjects (not even
    Object), so we need to fill it.  With an empty EquivObjects,
    RolesWithRight returns all the roles which could ever have that right.
    
    This only seems to have affected the generation of the possible owners
    on a ticket.
    
    Broken in 932a5a25a3520f42471e82df5688cf18b26700c4, since 3.8.8.
    
    Reported by Paul Crovella as [rt3 #16656].  This fix slightly modifies
    his suggested fix with s/push/unshift/ to be more consistent with our
    EquivObjects handling elsewhere.
    
    Backported from 4.0/fix-users-whohaveroleright.

diff --git a/lib/RT/Users_Overlay.pm b/lib/RT/Users_Overlay.pm
index a0eabed..9640925 100755
--- a/lib/RT/Users_Overlay.pm
+++ b/lib/RT/Users_Overlay.pm
@@ -405,6 +405,12 @@ sub WhoHaveRoleRight
     );
 
     my @objects = $self->_GetEquivObjects( %args );
+
+    # RT::Principal->RolesWithRight only expects EquivObjects, so we need to
+    # fill it.  At the very least it needs $args{Object}, which
+    # _GetEquivObjects above does for us.
+    unshift @{$args{'EquivObjects'}}, @objects;
+
     my @roles = RT::Principal->RolesWithRight( %args );
     unless ( @roles ) {
         $self->_AddSubClause( "WhichRole", "(main.id = 0)" );

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


More information about the Rt-commit mailing list