summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authorbugreport%peshkin.net <>2004-08-11 14:08:10 +0200
committerbugreport%peshkin.net <>2004-08-11 14:08:10 +0200
commitdef7903801fcdbab2f227688375f38c5cb490f27 (patch)
tree770f8d2e9c056cbdf05065b3c86c8f3051210402 /Bugzilla/User.pm
parentd7a8d47bebd3e45bb9b508e38e594a7b90407a06 (diff)
downloadbugzilla-def7903801fcdbab2f227688375f38c5cb490f27.tar.gz
bugzilla-def7903801fcdbab2f227688375f38c5cb490f27.tar.xz
Bug 251669: add an option to show users in a drop down menu instead of a text edit field
patch by glob <bugzilla@glob.com.au> r=joel a=justdave
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r--Bugzilla/User.pm46
1 files changed, 46 insertions, 0 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 71e2358fe..a40450076 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -21,6 +21,7 @@
# Erik Stambaugh <erik@dasbistro.com>
# Bradley Baetz <bbaetz@acm.org>
# Joel Peshkin <bugreport@peshkin.net>
+# Byron Jones <bugzilla@glob.com.au>
################################################################################
# Module Initialization
@@ -888,6 +889,45 @@ sub email_prefs {
return $self->{email_prefs};
}
+sub get_userlist {
+ my $self = shift;
+
+ return $self->{'userlist'} if defined $self->{'userlist'};
+
+ my $query = "SELECT DISTINCT login_name, realname,";
+ if (&::Param('usevisibilitygroups')) {
+ $query .= " COUNT(group_id) ";
+ } else {
+ $query .= " 1 ";
+ }
+ $query .= "FROM profiles ";
+ if (&::Param('usevisibilitygroups')) {
+ $query .= "LEFT JOIN user_group_map " .
+ "ON user_group_map.user_id = userid AND isbless = 0 " .
+ "AND group_id IN(" .
+ join(', ', (-1, @{$self->visible_groups_inherited})) . ") " .
+ "AND grant_type <> " . GRANT_DERIVED;
+ }
+ $query .= " WHERE disabledtext = '' GROUP BY userid";
+
+ my $dbh = Bugzilla->dbh;
+ my $sth = $dbh->prepare($query);
+ $sth->execute;
+
+ my @userlist;
+ while (my($login, $name, $visible) = $sth->fetchrow_array) {
+ push @userlist, {
+ login => $login,
+ identity => $name ? "$name <$login>" : $login,
+ visible => $visible,
+ };
+ }
+ @userlist = sort { lc $$a{'identity'} cmp lc $$b{'identity'} } @userlist;
+
+ $self->{'userlist'} = \@userlist;
+ return $self->{'userlist'};
+}
+
1;
__END__
@@ -1032,6 +1072,12 @@ the user can select bugs. If the $by_id parameter is true, it returns
a hash where the keys are the product ids and the values are the
product names.
+=item C<get_userlist>
+
+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<visible_groups_inherited>
Returns a list of all groups whose members should be visible to this user.