[Rt-commit] r8036 - rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT
ruz at bestpractical.com
ruz at bestpractical.com
Thu Jun 28 07:40:16 EDT 2007
Author: ruz
Date: Thu Jun 28 07:40:06 2007
New Revision: 8036
Modified:
rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Group_Overlay.pm
Log:
* add Recursively argument to $group->UserMembersObj
Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Group_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Group_Overlay.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Group_Overlay.pm Thu Jun 28 07:40:06 2007
@@ -782,7 +782,6 @@
$groups->Limit(
ALIAS => $members_alias,
FIELD => 'GroupId',
- OPERATOR => '=',
VALUE => $self->PrincipalId,
);
$groups->Limit(
@@ -800,26 +799,38 @@
=head2 UserMembersObj
-Returns an RT::Users object of this group's members, including
-all members of subgroups
+Returns an L<RT::Users> object of this group's members, by default
+returns users including all members of subgroups, but could be
+changed with C<Recursively> named argument.
=cut
sub UserMembersObj {
my $self = shift;
-
- my $users = RT::Users->new($self->CurrentUser);
+ my %args = ( Recursively => 1, @_ );
#If we don't have rights, don't include any results
# TODO XXX WHY IS THERE NO ACL CHECK HERE?
- my $cached_members = $users->NewAlias('CachedGroupMembers');
- $users->Join(ALIAS1 => $cached_members, FIELD1 => 'MemberId',
- ALIAS2 => $users->PrincipalsAlias, FIELD2 => 'id');
- $users->Limit(ALIAS => $cached_members,
- FIELD => 'GroupId',
- OPERATOR => '=',
- VALUE => $self->PrincipalId);
+ my $members_table = $args{'Recursively'}?
+ 'CachedGroupMembers': 'GroupMembers';
+
+ my $users = RT::Users->new($self->CurrentUser);
+ my $members_alias = $users->NewAlias( $members_table );
+ $users->Join(
+ ALIAS1 => $members_alias, FIELD1 => 'MemberId',
+ ALIAS2 => $users->PrincipalsAlias, FIELD2 => 'id',
+ );
+ $users->Limit(
+ ALIAS => $members_alias,
+ FIELD => 'GroupId',
+ VALUE => $self->PrincipalId,
+ );
+ $users->Limit(
+ ALIAS => $members_alias,
+ FIELD => 'Disabled',
+ VALUE => 0,
+ ) if $args{'Recursively'};
return ( $users);
}
More information about the Rt-commit
mailing list