Closed Bug 1012508 Opened 10 years ago Closed 10 years ago

Add a admin_menu hook to change who has access to admin.cgi

Categories

(Bugzilla :: Administration, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 5.0

People

(Reporter: mail, Assigned: mail)

Details

Attachments

(1 file, 2 obsolete files)

We have template hooks in t/e/d/admin/admin.html.tmpl to add extra items to the admin menu, but that requires that the new option uses one of the existing privileges.

This change allows an extension code to change whether a user can see admin.cgi or not.
Attached patch bug1012508-v1.patch (obsolete) — Splinter Review
dkl is excluded from reviewing since this is brc code from before my time. He may or may not have written or reviewed the change.
Attachment #8424570 - Flags: review?(gerv)
Attached patch bug1012508-v1.patch (obsolete) — Splinter Review
Attachment #8424570 - Attachment is obsolete: true
Attachment #8424570 - Flags: review?(gerv)
Attachment #8424572 - Flags: review?(gerv)
Comment on attachment 8424572 [details] [diff] [review]
bug1012508-v1.patch

I'm revoking this patch, as it can be done better. Currently the rules are also duplicated in common-links.html.tmpl. So will create a new function in Bugzilla::User that does this once.
Attachment #8424572 - Attachment is obsolete: true
Attachment #8424572 - Flags: review?(gerv)
Flags: needinfo?(sgreen)
Okay. Third crack at my first patch. This does it much better IMO.
Attachment #8439689 - Flags: review?(gerv)
Flags: needinfo?(sgreen)
Comment on attachment 8439689 [details] [diff] [review]
bug1012508-v1.patch

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

With the name changes, r=gerv.

Gerv

::: Bugzilla/User.pm
@@ +1446,4 @@
>      return [ sort { $a->name cmp $b->name } values %products ];
>  }
>  
> +sub can_see_admin {

I'd call this can_administer.

::: extensions/Example/Extension.pm
@@ +31,4 @@
>  
>  our $VERSION = '1.0';
>  
> +sub admin_menu {

This makes it sound like the hook allows you to add to the admin menu. I'd go for user_can_administer (hooks often seem to be prefixed with category or object names).
Attachment #8439689 - Flags: review?(gerv) → review+
Flags: approval?
Target Milestone: --- → Bugzilla 5.0
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   6c6efdd..80c434b  master -> master
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: approval? → approval+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: