summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-08-08 20:58:19 +0200
committerlpsolit%gmail.com <>2007-08-08 20:58:19 +0200
commit152f61366bd9b268cd838307c1e58399003ef2c7 (patch)
tree92fb18a7f824cb450db3df0fdea8407cc05d7f29 /Bugzilla/User.pm
parent8d9074a59f0bfa4b79256e5524a447397e3490de (diff)
downloadbugzilla-152f61366bd9b268cd838307c1e58399003ef2c7.tar.gz
bugzilla-152f61366bd9b268cd838307c1e58399003ef2c7.tar.xz
Bug 332149: Ability to have symbols placed next to user names based on group membership - Patch by Frédéric Buclin <LpSolit@gmail.com> r=myk a=LpSolit
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r--Bugzilla/User.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index f73dd06df..cf8de0274 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -800,6 +800,24 @@ sub can_set_flag {
|| $self->in_group_id($flag_type->grant_group->id)) ? 1 : 0;
}
+sub direct_group_membership {
+ my $self = shift;
+ my $dbh = Bugzilla->dbh;
+
+ if (!$self->{'direct_group_membership'}) {
+ my $gid = $dbh->selectcol_arrayref('SELECT id
+ FROM groups
+ INNER JOIN user_group_map
+ ON groups.id = user_group_map.group_id
+ WHERE user_id = ?
+ AND isbless = 0',
+ undef, $self->id);
+ $self->{'direct_group_membership'} = Bugzilla::Group->new_from_list($gid);
+ }
+ return $self->{'direct_group_membership'};
+}
+
+
# visible_groups_inherited returns a reference to a list of all the groups
# whose members are visible to this user.
sub visible_groups_inherited {
@@ -2026,6 +2044,11 @@ 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
+by group inheritance are excluded from the list.
+
=item C<visible_groups_inherited>
Returns a list of all groups whose members should be visible to this user.