Need new hook edituser page

RESOLVED FIXED in Bugzilla 4.2

Status

()

Bugzilla
Administration
--
enhancement
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Francisco Donalisio, Assigned: Francisco Donalisio)

Tracking

Bugzilla 4.2
Bug Flags:
approval +
approval4.2 +

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

6 years ago
A new hook in the edituser admin page, would allow new actions for the administrator in the page.
(Assignee)

Comment 1

6 years ago
Created attachment 600889 [details] [diff] [review]
Creates the new hook
Attachment #600889 - Flags: review?(dkl)
Comment on attachment 600889 [details] [diff] [review]
Creates the new hook

Review of attachment 600889 [details] [diff] [review]:
-----------------------------------------------------------------

Rename hook to admin_editusers_action to further describe that the hook is for and to put all admin related hooks in it's
own admin_* namespace. Plus using user_ makes it seem like it should be in User.pm. Also use _action instead of _actions.

Thanks for the patch!

::: Bugzilla/Hook.pm
@@ +1341,5 @@
>  
> +=head2 user_actions
> +
> +This hook allows you to add additional actions the admin Users page,
> +See the C<Example> extension to see how

This hook allows you to to add additional actions to the editusers.cgi admin page.

@@ +1342,5 @@
> +=head2 user_actions
> +
> +This hook allows you to add additional actions the admin Users page,
> +See the C<Example> extension to see how
> +things work.

No need to mention the Example extension as it is mentioned in the top of the perldocs that the Example extension has example code for all hooks.

::: editusers.cgi
@@ +55,5 @@
> +    {   'vars'   => $vars,
> +        'user'   => $user,
> +        'action' => $action
> +    }
> +);

Nit:

Bugzilla::Hook::process('admin_editusers_action', 
    { vars => $vars, user => $user, action => $action });
Attachment #600889 - Flags: review?(dkl) → review-
(Assignee)

Comment 3

6 years ago
Created attachment 603361 [details] [diff] [review]
Creates the new hook
Assignee: administration → francsd
Attachment #600889 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #603361 - Flags: review?(dkl)
Comment on attachment 603361 [details] [diff] [review]
Creates the new hook

Review of attachment 603361 [details] [diff] [review]:
-----------------------------------------------------------------

Looks better but a few more small changes.

::: Bugzilla/Hook.pm
@@ +1368,5 @@
> +It will be passed to the template.
> +
> +=item C<action>
> +
> +A text which indicates the different behaviors that edit_users.cgi will have.

s/edit_users/editusers/

::: extensions/Example/Extension.pm
@@ +811,5 @@
> +    my ($self, $args) = @_;
> +    my ($vars, $action, $user) = @$args{qw(vars action user)};
> +    my $template = Bugzilla->template;
> +
> +    if ($action eq 'search') {

After looking at this some more, let's come up with some different example code for this hook. Something that would be harmless if the admin mistakenly enabled the Example extension. Right now if they did enable, this would replace some actual functionality in editusers.cgi and they may not get what they expect or later or upstream changes editusers.cgi in some way which would be masked by this extension.

@@ +816,5 @@
> +        # 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;

Fix indention of exit;
Attachment #603361 - Flags: review?(dkl) → review-
(Assignee)

Comment 5

6 years ago
Created attachment 604013 [details] [diff] [review]
Creates the new hook
Attachment #603361 - Attachment is obsolete: true
Attachment #604013 - Flags: review?(dkl)
Comment on attachment 604013 [details] [diff] [review]
Creates the new hook

Review of attachment 604013 [details] [diff] [review]:
-----------------------------------------------------------------

Everything looks fine to me. The documentation change can be made at checkin.

dkl

::: Bugzilla/Hook.pm
@@ +1368,5 @@
> +It will be passed to the template.
> +
> +=item C<action>
> +
> +A text which indicates the different behaviors that edit_users.cgi will have.

Replace edit_users.cgi with editusers.cgi.
Attachment #604013 - Flags: review?(dkl) → review+

Updated

6 years ago
Flags: approval?
Flags: approval4.2?

Comment 7

6 years ago
Comment on attachment 604013 [details] [diff] [review]
Creates the new hook

>=== modified file 'Bugzilla/Hook.pm'

>+This hook allows you to add additional actions to the admin Users page,

The sentence must end with a period, not a comma.

Updated

6 years ago
Flags: approval?
Flags: approval4.2?
Flags: approval4.2+
Flags: approval+
Target Milestone: --- → Bugzilla 4.2
Thanks for the work. Checking in.

trunk:
Committing to: bzr+ssh://dlawrence%40mozilla.com@bzr.mozilla.org/bugzilla/trunk
modified extensions/Example/Extension.pm
modified editusers.cgi
modified Bugzilla/Hook.pm
Committed revision 8151.

4.2:
Committing to: bzr+ssh://dlawrence%40mozilla.com@bzr.mozilla.org/bugzilla/4.2
modified extensions/Example/Extension.pm
modified editusers.cgi
modified Bugzilla/Hook.pm
Committed revision 8048.
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.