[Rt-commit] rt branch, 4.0/fix-users-whohaveroleright, created. rt-4.0.0rc6-13-g325cca6
Thomas Sibley
trs at bestpractical.com
Fri Mar 4 15:22:17 EST 2011
The branch, 4.0/fix-users-whohaveroleright has been created
at 325cca62894f918bb0bc63ac7fdd65348ad45e02 (commit)
- Log -----------------------------------------------------------------
commit 325cca62894f918bb0bc63ac7fdd65348ad45e02
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Mar 4 15:12:27 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.
diff --git a/lib/RT/Users.pm b/lib/RT/Users.pm
index bf555ff..c9cc78d 100644
--- a/lib/RT/Users.pm
+++ b/lib/RT/Users.pm
@@ -404,6 +404,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