From 152f61366bd9b268cd838307c1e58399003ef2c7 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 8 Aug 2007 18:58:19 +0000 Subject: Bug 332149: Ability to have symbols placed next to user names based on group membership - Patch by Frédéric Buclin r=myk a=LpSolit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/User.pm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Bugzilla/User.pm') 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 + +Returns a reference to an array of group objects. Groups the user belong to +by group inheritance are excluded from the list. + =item C Returns a list of all groups whose members should be visible to this user. -- cgit v1.2.3-24-g4f1b