[Rt-commit] rt branch 5.0/make-owngroups-optionally-recursive created. rt-5.0.5-118-g787d469be3

BPS Git Server git at git.bestpractical.com
Fri Jan 12 19:49:19 UTC 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/make-owngroups-optionally-recursive has been created
        at  787d469be3f4c25823e60877b1217cca5a7e38ce (commit)

- Log -----------------------------------------------------------------
commit 787d469be3f4c25823e60877b1217cca5a7e38ce
Author: Jason Crome <jcrome at bestpractical.com>
Date:   Fri Jan 12 14:39:38 2024 -0500

    Make RT::User::OwnGroups() optionally recursive
    
    When $SelfServiceShowGroupTickets is set to 1, the My Group Tickets
    portlet in self-service would recursively search for all of a user's
    group memberships. In some cases, this could degrade search performance
    by trying to return tickets belonging to other groups. By making
    OwnGroups() optionally recursive, both issues are avoided.

diff --git a/lib/RT/User.pm b/lib/RT/User.pm
index 4a881003bc..af59aa2c3e 100644
--- a/lib/RT/User.pm
+++ b/lib/RT/User.pm
@@ -1570,11 +1570,15 @@ user is a member.
 
 sub OwnGroups {
     my $self = shift;
+    my %args = (
+        Recursively => 1,
+        @_    # get the real argumentlist
+    );
     my $groups = RT::Groups->new($self->CurrentUser);
     $groups->LimitToUserDefinedGroups;
     $groups->WithMember(
         PrincipalId => $self->Id,
-        Recursively => 1
+        Recursively => $args{ Recursively },
     );
     return $groups;
 }
diff --git a/share/html/SelfService/Elements/MyGroupRequests b/share/html/SelfService/Elements/MyGroupRequests
index 96d730a783..68ad9519c9 100644
--- a/share/html/SelfService/Elements/MyGroupRequests
+++ b/share/html/SelfService/Elements/MyGroupRequests
@@ -75,7 +75,7 @@ unless ( $ret ){
     RT::Logger->error("Unable to load user record for user: " . $session{'CurrentUser'}->Name . " :$msg");
     return;
 }
-my $groups_obj = $user->OwnGroups;
+my $groups_obj = $user->OwnGroups( Recursively => 0 );
 
 my $Query = '';
 

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list