Commit 012dada9 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 304268: edit users form should have an item for "edit this user" - Patch by…

Bug 304268: edit users form should have an item for "edit this user" - Patch by GavinS <bugzilla@chimpychompy.org> r=wurblzap a=justdave
parent 46140909
...@@ -118,6 +118,9 @@ if ($action eq 'search') { ...@@ -118,6 +118,9 @@ if ($action eq 'search') {
} elsif ($matchtype eq 'notregexp') { } elsif ($matchtype eq 'notregexp') {
$query .= $dbh->sql_not_regexp($expr, '?'); $query .= $dbh->sql_not_regexp($expr, '?');
$matchstr = '.' unless $matchstr; $matchstr = '.' unless $matchstr;
} elsif ($matchtype eq 'exact') {
$query .= $expr . ' = ?';
$matchstr = '.' unless $matchstr;
} else { # substr or unknown } else { # substr or unknown
$query .= $expr . ' like ?'; $query .= $expr . ' like ?';
$matchstr = "%$matchstr%"; $matchstr = "%$matchstr%";
...@@ -142,10 +145,17 @@ if ($action eq 'search') { ...@@ -142,10 +145,17 @@ if ($action eq 'search') {
$vars->{'users'} = $dbh->selectall_arrayref($query, $vars->{'users'} = $dbh->selectall_arrayref($query,
{'Slice' => {}}, {'Slice' => {}},
@bindValues); @bindValues);
} }
$template->process('admin/users/list.html.tmpl', $vars) if ($matchtype eq 'exact' && scalar(@{$vars->{'users'}}) == 1) {
|| ThrowTemplateError($template->error()); $otherUserID = $vars->{'users'}[0]->{'userid'};
$otherUser = new Bugzilla::User($otherUserID);
edit_processing();
} else {
$template->process('admin/users/list.html.tmpl', $vars)
|| ThrowTemplateError($template->error());
}
########################################################################### ###########################################################################
} elsif ($action eq 'add') { } elsif ($action eq 'add') {
...@@ -198,18 +208,8 @@ if ($action eq 'search') { ...@@ -198,18 +208,8 @@ if ($action eq 'search') {
########################################################################### ###########################################################################
} elsif ($action eq 'edit') { } elsif ($action eq 'edit') {
$otherUser
|| ThrowCodeError('invalid_user_id', {'userid' => $cgi->param('userid')});
$user->can_see_user($otherUser)
|| ThrowUserError('auth_failure', {reason => "not_visible",
action => "modify",
object => "user"});
userDataToVars($otherUserID); edit_processing();
$template->process('admin/users/edit.html.tmpl', $vars)
|| ThrowTemplateError($template->error());
########################################################################### ###########################################################################
} elsif ($action eq 'update') { } elsif ($action eq 'update') {
...@@ -778,3 +778,20 @@ sub userDataToVars { ...@@ -778,3 +778,20 @@ sub userDataToVars {
$vars->{'permissions'}{${$_}[0]}{'indirectbless'} = 1; $vars->{'permissions'}{${$_}[0]}{'indirectbless'} = 1;
} }
} }
sub edit_processing
{
$otherUser
|| ThrowCodeError('invalid_user_id', {'userid' => $cgi->param('userid')});
$user->can_see_user($otherUser)
|| ThrowUserError('auth_failure', {reason => "not_visible",
action => "modify",
object => "user"});
userDataToVars($otherUserID);
$template->process('admin/users/edit.html.tmpl', $vars)
|| ThrowTemplateError($template->error());
}
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
[% IF listselectionvalues %], [% IF listselectionvalues %],
[% END %] [% END %]
[% END %] [% END %]
[% IF listselectionvalues %] [% IF listselectionvalues.matchtype != 'exact' %]
go go
<a href="editusers.cgi?action=list[% INCLUDE listselectionurlparams %]">back <a href="editusers.cgi?action=list[% INCLUDE listselectionurlparams %]">back
to the user list</a>, to the user list</a>,
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
<option value="substr" selected="selected">case-insensitive substring</option> <option value="substr" selected="selected">case-insensitive substring</option>
<option value="regexp">case-insensitive regexp</option> <option value="regexp">case-insensitive regexp</option>
<option value="notregexp">not (case-insensitive regexp)</option> <option value="notregexp">not (case-insensitive regexp)</option>
<option value="exact">exact (find this user)</option>
</select> </select>
<input type="submit" value="Search" /></p> <input type="submit" value="Search" /></p>
......
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