Skip to content

Commit

Permalink
Merge branch '5.0/make-owngroups-optionally-recursive' into 5.0-trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnavy committed Jan 30, 2024
2 parents 57099ec + 0d0e862 commit a9eae99
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/RT/User.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1561,20 +1561,24 @@ sub HasGroupRight {
return ($retval);
}

=head2 OwnGroups
=head2 OwnGroups Recursively => 1|0
Returns a group collection object containing the groups of which this
user is a member.
user is a member, recursively by default.
=cut

sub OwnGroups {
my $self = shift;
my %args = (
Recursively => 1,
@_,
);
my $groups = RT::Groups->new($self->CurrentUser);
$groups->LimitToUserDefinedGroups;
$groups->WithMember(
PrincipalId => $self->Id,
Recursively => 1
Recursively => $args{'Recursively'},
);
return $groups;
}
Expand Down
2 changes: 1 addition & 1 deletion share/html/SelfService/Elements/MyGroupRequests
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';

Expand Down

0 comments on commit a9eae99

Please sign in to comment.