-#!/usr/bin/perl -wT
+#!/usr/bin/perl -wT
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla Public
# Contributor(s): Marc Schumann <wurblzap@gmail.com>
# Lance Larsh <lance.larsh@oracle.com>
# Frédéric Buclin <LpSolit@gmail.com>
+# David Lawrence <dkl@redhat.com>
use strict;
use lib ".";
###########################################################################
} elsif ($action eq 'list') {
+ my $matchvalue = $cgi->param('matchvalue') || '';
my $matchstr = $cgi->param('matchstr');
my $matchtype = $cgi->param('matchtype');
my $grouprestrict = $cgi->param('grouprestrict') || '0';
$vars->{'users'} = {};
}
else {
- # Handle selection by user name.
+ # Handle selection by login name, real name, or userid.
if (defined($matchtype)) {
$query .= " $nextCondition ";
- my $expr = "profiles.login_name";
+ my $expr = "";
+ if ($matchvalue eq 'userid') {
+ if ($matchstr) {
+ my $stored_matchstr = $matchstr;
+ detaint_natural($matchstr)
+ || ThrowUserError('illegal_user_id', {userid => $stored_matchstr});
+ }
+ $expr = "profiles.userid";
+ } elsif ($matchvalue eq 'realname') {
+ $expr = "profiles.realname";
+ } else {
+ $expr = "profiles.login_name";
+ }
if ($matchtype eq 'regexp') {
$query .= $dbh->sql_regexp($expr, '?');
$matchstr = '.' unless $matchstr;
# Copy incoming list selection values from CGI params to template variables.
sub mirrorListSelectionValues {
if (defined($cgi->param('matchtype'))) {
- foreach ('matchstr', 'matchtype', 'grouprestrict', 'groupid') {
+ foreach ('matchvalue', 'matchstr', 'matchtype', 'grouprestrict', 'groupid') {
$vars->{'listselectionvalues'}{$_} = $cgi->param($_);
}
}
# The Original Code is the Bugzilla Bug Tracking System.
#
# Contributor(s): Marc Schumann <wurblzap@gmail.com>
+ # David Lawrence <dkl@redhat.com>
#%]
[%# INTERFACE:
<form name="f" method="get" action="editusers.cgi">
<input type="hidden" name="action" value="list" />
-<p><label for="matchstr">List users with login name matching</label>
+<p><label for="matchvalue">List users with</label>
+<select id="matchvalue" name="matchvalue">
+ <option value="login_name">login name</option>
+ <option value="realname">real name</option>
+ <option value="userid">user id</option>
+</select>
+<label for="matchstr">matching</label>
<input size="32" name="matchstr" id="matchstr" />
<select name="matchtype">
<option value="substr" selected="selected">case-insensitive substring</option>