future ticket resolve fixes, #13583
[freeside.git] / rt / lib / RT / Users_Overlay.pm
index a0eabed..16ec5ed 100644 (file)
@@ -379,6 +379,7 @@ sub WhoHaveRight {
     $from_group->WhoHaveGroupRight( %args );
 
     #XXX: DIRTY HACK
+    use DBIx::SearchBuilder 1.50; #no version on ::Union :(
     use DBIx::SearchBuilder::Union;
     my $union = new DBIx::SearchBuilder::Union;
     $union->add( $from_group );
@@ -405,6 +406,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)" );