Mailing List Archive

rt branch 5.0/make-owngroups-optionally-recursive created. rt-5.0.5-118-g5f49678901
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 5f4967890188ddb9c526ab158a5b33ac77a2e3cd (commit)

- Log -----------------------------------------------------------------
commit 5f4967890188ddb9c526ab158a5b33ac77a2e3cd
Author: Jason Crome <jcrome@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..cde2b5a17d 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
_______________________________________________
rt-commit mailing list
rt-commit@lists.bestpractical.com
https://lists.bestpractical.com/mailman/listinfo/rt-commit