]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 730794 - Need new hook edituser page
authorFrancisco Donalisio <francsd@linux.vnet.ibm.com>
Fri, 9 Mar 2012 20:10:17 +0000 (15:10 -0500)
committerDave Lawrence <dlawrence@mozilla.com>
Fri, 9 Mar 2012 20:10:17 +0000 (15:10 -0500)
r=dkl, a=LpSolit

Bugzilla/Hook.pm
editusers.cgi
extensions/Example/Extension.pm

index b2ea820c7bb89b73a6772a9eb1b367080ff8a097..7274c8aab6f381d6e5cc91b51058e87d9acb8ee5 100644 (file)
@@ -1354,6 +1354,30 @@ name), you can get it from here.
 
 =back
 
+=head2 admin_editusers_action
+
+This hook allows you to add additional actions to the admin Users page,
+
+Params:
+
+=over
+
+=item C<vars>
+
+You can add as many new key/value pairs as you want to this hashref.
+It will be passed to the template.
+
+=item C<action>
+
+A text which indicates the different behaviors that edit_users.cgi will have.
+With this hook you can change the behavior of an action or add new actions.
+
+=item C<user>
+
+This is a Bugzilla::User object of the user.
+
+=back
+
 =head2 user_preferences
 
 This hook allows you to add additional panels to the User Preferences page,
index c25c5e9ef07f7a7d29622a167a240c568274d9ac..4182f68753e36d03e69e951c12fef6a966d963e8 100755 (executable)
@@ -64,6 +64,9 @@ my $token          = $cgi->param('token');
 $vars->{'editusers'} = $editusers;
 mirrorListSelectionValues();
 
+Bugzilla::Hook::process('admin_editusers_action',
+    { vars => $vars, user => $user, action => $action });
+
 ###########################################################################
 if ($action eq 'search') {
     # Allow to restrict the search to any group the user is allowed to bless.
index 4498d2b2225a57c88bcdba47255fcef409379784..af56b506bea7bc236f99d97cbb36ff0ccfc9b008 100644 (file)
@@ -822,6 +822,20 @@ sub bug_check_can_change_field {
     }
 }
 
+sub admin_editusers_action {
+    my ($self, $args) = @_;
+    my ($vars, $action, $user) = @$args{qw(vars action user)};
+    my $template = Bugzilla->template;
+
+    if ($action eq 'my_action') {
+        # Allow to restrict the search to any group the user is allowed to bless.
+        $vars->{'restrictablegroups'} = $user->bless_groups();
+        $template->process('admin/users/search.html.tmpl', $vars)
+            || ThrowTemplateError($template->error());
+        exit;
+    }
+}
+
 sub user_preferences {
     my ($self, $args) = @_;
     my $tab = $args->{current_tab};