From 19e709e51b9be52b90bc16f27eaf323be475fe69 Mon Sep 17 00:00:00 2001 From: Francisco Donalisio Date: Fri, 9 Mar 2012 15:04:11 -0500 Subject: Bug 730794 - Need new hook edituser page r=dkl, a=LpSolit --- Bugzilla/Hook.pm | 24 ++++++++++++++++++++++++ editusers.cgi | 3 +++ extensions/Example/Extension.pm | 14 ++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/Bugzilla/Hook.pm b/Bugzilla/Hook.pm index 17023f8f5..0db7baf7d 100644 --- a/Bugzilla/Hook.pm +++ b/Bugzilla/Hook.pm @@ -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 + +You can add as many new key/value pairs as you want to this hashref. +It will be passed to the template. + +=item C + +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 + +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, diff --git a/editusers.cgi b/editusers.cgi index b4b86b880..e2675921b 100755 --- a/editusers.cgi +++ b/editusers.cgi @@ -50,6 +50,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. diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm index 4c2d51336..a2ab3b5fc 100644 --- a/extensions/Example/Extension.pm +++ b/extensions/Example/Extension.pm @@ -807,6 +807,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}; -- cgit v1.2.3-24-g4f1b