summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2009-01-25 19:49:30 +0100
committerlpsolit%gmail.com <>2009-01-25 19:49:30 +0100
commitca06c57995ed327879e4c23b58e1330d4bd27d18 (patch)
tree55551daf4341fed6cac00eda8c68ae7932786f5c /Bugzilla/User.pm
parentd3f1b1a3ecc5f068179d5fba70e86b345c1aec63 (diff)
downloadbugzilla-ca06c57995ed327879e4c23b58e1330d4bd27d18.tar.gz
bugzilla-ca06c57995ed327879e4c23b58e1330d4bd27d18.tar.xz
Bug 405355: Move flatten_group_membership() from User.pm to Group.pm - Patch by arbingersys <arbingersys@gmail.com> r/a=LpSolit
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r--Bugzilla/User.pm35
1 files changed, 2 insertions, 33 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 0c0f45bc0..fe04856aa 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -48,6 +48,7 @@ use Bugzilla::User::Setting;
use Bugzilla::Product;
use Bugzilla::Classification;
use Bugzilla::Field;
+use Bugzilla::Group;
use Scalar::Util qw(blessed);
use DateTime::TimeZone;
@@ -830,7 +831,7 @@ sub visible_groups_inherited {
return $self->{visible_groups_inherited} if defined $self->{visible_groups_inherited};
return [] unless $self->id;
my @visgroups = @{$self->visible_groups_direct};
- @visgroups = @{$self->flatten_group_membership(@visgroups)};
+ @visgroups = @{Bugzilla::Group->flatten_group_membership(@visgroups)};
$self->{visible_groups_inherited} = \@visgroups;
return $self->{visible_groups_inherited};
}
@@ -992,30 +993,6 @@ sub can_bless {
return grep($_->id == $group_id, @{ $self->bless_groups }) ? 1 : 0;
}
-sub flatten_group_membership {
- my ($self, @groups) = @_;
-
- my $dbh = Bugzilla->dbh;
- my $sth;
- my @groupidstocheck = @groups;
- my %groupidschecked = ();
- $sth = $dbh->prepare("SELECT member_id FROM group_group_map
- WHERE grantor_id = ?
- AND grant_type = " . GROUP_MEMBERSHIP);
- while (my $node = shift @groupidstocheck) {
- $sth->execute($node);
- my $member;
- while (($member) = $sth->fetchrow_array) {
- if (!$groupidschecked{$member}) {
- $groupidschecked{$member} = 1;
- push @groupidstocheck, $member;
- push @groups, $member unless grep $_ == $member, @groups;
- }
- }
- }
- return \@groups;
-}
-
sub match {
# Generates a list of users whose login name (email address) or real name
# matches a substring or wildcard.
@@ -2049,14 +2026,6 @@ Returns a reference to an array of users. The array is populated with hashrefs
containing the login, identity and visibility. Users that are not visible to this
user will have 'visible' set to zero.
-=item C<flatten_group_membership>
-
-Accepts a list of groups and returns a list of all the groups whose members
-inherit membership in any group on the list. So, we can determine if a user
-is in any of the groups input to flatten_group_membership by querying the
-user_group_map for any user with DIRECT or REGEXP membership IN() the list
-of groups returned.
-
=item C<direct_group_membership>
Returns a reference to an array of group objects. Groups the user belong to