Commit 41eda66a authored by Sunil Joshi's avatar Sunil Joshi Committed by Simon Green

Bug 331529 - editusers list should let me search for disabled users

r=simon, a=simon
parent a1911aa1
...@@ -68,7 +68,7 @@ if ($action eq 'search') { ...@@ -68,7 +68,7 @@ if ($action eq 'search') {
my $matchstr = trim($cgi->param('matchstr')); my $matchstr = trim($cgi->param('matchstr'));
my $matchtype = $cgi->param('matchtype'); my $matchtype = $cgi->param('matchtype');
my $grouprestrict = $cgi->param('grouprestrict') || '0'; my $grouprestrict = $cgi->param('grouprestrict') || '0';
my $enabled_only = $cgi->param('enabled_only') || '0'; my $is_enabled = scalar $cgi->param('is_enabled');
my $query = 'SELECT DISTINCT userid, login_name, realname, is_enabled, ' . my $query = 'SELECT DISTINCT userid, login_name, realname, is_enabled, ' .
$dbh->sql_date_format('last_seen_date', '%Y-%m-%d') . ' AS last_seen_date ' . $dbh->sql_date_format('last_seen_date', '%Y-%m-%d') . ' AS last_seen_date ' .
'FROM profiles'; 'FROM profiles';
...@@ -160,11 +160,12 @@ if ($action eq 'search') { ...@@ -160,11 +160,12 @@ if ($action eq 'search') {
$query .= " $nextCondition ugm.group_id IN($grouplist) "; $query .= " $nextCondition ugm.group_id IN($grouplist) ";
} }
if ($enabled_only eq '1') { detaint_natural($is_enabled);
$query .= " $nextCondition profiles.is_enabled = 1 "; if ($is_enabled == 0 || $is_enabled == 1) {
$query .= " $nextCondition profiles.is_enabled = ?";
$nextCondition = 'AND'; $nextCondition = 'AND';
push(@bindValues, $is_enabled);
} }
$query .= ' ORDER BY profiles.login_name'; $query .= ' ORDER BY profiles.login_name';
$vars->{'users'} = $dbh->selectall_arrayref($query, $vars->{'users'} = $dbh->selectall_arrayref($query,
......
...@@ -56,9 +56,13 @@ ...@@ -56,9 +56,13 @@
[% END %] [% END %]
<p> <p>
<input type="checkbox" name="enabled_only" value="1" id="enabled_only" Restrict search to
checked="checked"> <select name="is_enabled">
<label for="enabled_only">Enabled user accounts only</label> <option value="2">All</option>
<option value="1" selected>Enabled</option>
<option value="0">Disabled</option>
</select>
users.
</p> </p>
[% Hook.process('end') %] [% Hook.process('end') %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment