From 0d3a72b793725118641c4d7abf511b4fc98f7aef Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sat, 11 Nov 2006 00:51:27 +0000 Subject: Bug 189627: Implement per-product privileges - Patch by Frédéric Buclin r=mkanat a=myk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../en/default/account/prefs/permissions.html.tmpl | 18 +++++++++++- template/en/default/admin/products/edit.html.tmpl | 3 ++ .../en/default/admin/products/footer.html.tmpl | 2 +- .../admin/products/groupcontrol/edit.html.tmpl | 32 +++++++++++++++++++++- .../default/admin/users/confirm-delete.html.tmpl | 23 ++++++++-------- template/en/default/attachment/create.html.tmpl | 10 +++---- template/en/default/bug/create/create.html.tmpl | 2 +- template/en/default/filterexceptions.pl | 2 +- .../en/default/global/site-navigation.html.tmpl | 4 +-- template/en/default/global/useful-links.html.tmpl | 5 +++- template/en/default/global/user-error.html.tmpl | 14 +++++----- 11 files changed, 83 insertions(+), 32 deletions(-) (limited to 'template') diff --git a/template/en/default/account/prefs/permissions.html.tmpl b/template/en/default/account/prefs/permissions.html.tmpl index 77dda1ce4..a178393ae 100644 --- a/template/en/default/account/prefs/permissions.html.tmpl +++ b/template/en/default/account/prefs/permissions.html.tmpl @@ -38,7 +38,6 @@ [% IF has_bits.size %] You have the following permission [% terms.bits %] set on your account:

-
[% FOREACH bit_description = has_bits %] @@ -47,6 +46,23 @@ [% END %]
+ + [% FOREACH privs = ["editcomponents", "canconfirm", "editbugs"] %] + [% SET products = ${"local_$privs"} %] + [% IF products && products.size %] +
+

+ You also have local '[% privs FILTER html %]' privileges + for the following products: +

+

+ [% FOREACH product = products %] + [% product.name FILTER html %]
+ [% END %] +

+ [% END %] + [% END %] + [% ELSE %] There are no permission [% terms.bits %] set on your account. [% END %] diff --git a/template/en/default/admin/products/edit.html.tmpl b/template/en/default/admin/products/edit.html.tmpl index 0371e3343..72a5532aa 100644 --- a/template/en/default/admin/products/edit.html.tmpl +++ b/template/en/default/admin/products/edit.html.tmpl @@ -112,6 +112,9 @@ versions: [% g.othercontrol FILTER html %] [% IF g.entry %], ENTRY[% END %] [% IF g.canedit %], CANEDIT[% END %] + [% IF g.editcomponents %], editcomponents[% END %] + [% IF g.canconfirm %], canconfirm[% END %] + [% IF g.editbugs %], editbugs[% END %] [% ELSE %] DISABLED [% END %] diff --git a/template/en/default/admin/products/footer.html.tmpl b/template/en/default/admin/products/footer.html.tmpl index 480868abd..a6330dbb2 100644 --- a/template/en/default/admin/products/footer.html.tmpl +++ b/template/en/default/admin/products/footer.html.tmpl @@ -45,7 +45,7 @@
-[% UNLESS no_add_product_link %] +[% UNLESS no_add_product_link || !user.in_group("editcomponents") %] Add a product[% -%] [%# Strictly speaking, we should not have to check for a diff --git a/template/en/default/admin/products/groupcontrol/edit.html.tmpl b/template/en/default/admin/products/groupcontrol/edit.html.tmpl index 32b5e9d8c..aff85be0d 100644 --- a/template/en/default/admin/products/groupcontrol/edit.html.tmpl +++ b/template/en/default/admin/products/groupcontrol/edit.html.tmpl @@ -42,6 +42,9 @@ MemberControl OtherControl Canedit + editcomponents + canconfirm + editbugs [% terms.Bugs %] [% FOREACH group = groups %] @@ -50,7 +53,7 @@ [% group.name FILTER html %] - + Disabled @@ -118,6 +121,18 @@ + + + + + + + + + [% group.bugcount %] @@ -146,6 +161,21 @@ the groups with Canedit selected. ONLY users who are members of all the canedit groups will be able to edit. This is an additional restriction that further restricts what can be edited by a user.

+The following settings control let you choose privileges on a per-product basis. +This is a convenient way to give privileges to some users for some products +only, without having to give them global privileges which would affect all +products: +

+Any group having editcomponents selected allows users who are +in this group to edit all aspects of this product, including components, +milestones and versions. +

+Any group having canconfirm selected allows users who are +in this group to confirm [% terms.bugs %] in this product. +

+Any group having editbugs selected allows users who are +in this group to edit all fields of [% terms.bugs %] in this product. +

The MemberControl and OtherControl fields indicate which [% terms.bugs %] will be placed in this group according to the following definitions. diff --git a/template/en/default/admin/users/confirm-delete.html.tmpl b/template/en/default/admin/users/confirm-delete.html.tmpl index 4c348fa10..0fd4aafa7 100644 --- a/template/en/default/admin/users/confirm-delete.html.tmpl +++ b/template/en/default/admin/users/confirm-delete.html.tmpl @@ -19,7 +19,6 @@ # listselectionvalues: selection values to recreate the current user # list. # editusers: is viewing user member of editusers? - # editcomponents: is viewing user member of editcomponents? # otheruser: Bugzilla::User object of the viewed user. # reporter: number of bugs reported by the user # assignee_or_qa: number of bugs the user is either the assignee @@ -57,8 +56,8 @@ %] [% responsibilityterms = { - 'initialowner' => 'Default Assignee', - 'initialqacontact' => 'Default QA Contact' + 'default_assignee' => 'Default Assignee', + 'default_qa_contact' => 'Default QA Contact' } %] @@ -93,21 +92,21 @@ [% FOREACH component = otheruser.product_responsibilities %]

  • [% andstring = '' %] - [% FOREACH responsibility = ['initialowner', 'initialqacontact'] %] - [% IF component.$responsibility == otheruser.id %] + [% FOREACH responsibility = ['default_assignee', 'default_qa_contact'] %] + [% IF component.${responsibility}.id == otheruser.id %] [% andstring %] [% responsibilityterms.$responsibility %] [% andstring = ' and ' %] [% END %] [% END %] for - [% IF editcomponents %] + [% IF user.in_group("editcomponents", component.product_id) %] + [% component.product.name FILTER url_quote %]&component= + [% component.name FILTER url_quote %]"> [% END %] - [%+ component.productname FILTER html %]: - [% component.componentname FILTER html %] - [% IF editcomponents %] + [%+ component.product.name FILTER html %]: + [% component.name FILTER html %] + [% IF user.in_group("editcomponents", component.product_id) %] [% END %]
  • @@ -125,7 +124,7 @@ one product.

    - [% IF editcomponents %] + [% IF user.in_group("editcomponents", component.product_id) %] Change this by clicking the product editing links above, [% ELSE %] For now, you can diff --git a/template/en/default/attachment/create.html.tmpl b/template/en/default/attachment/create.html.tmpl index fa2692d85..381c75901 100644 --- a/template/en/default/attachment/create.html.tmpl +++ b/template/en/default/attachment/create.html.tmpl @@ -25,10 +25,10 @@ [% PROCESS global/variables.none.tmpl %] [%# Define strings that will serve as the title and header of this page %] -[% title = BLOCK %]Create New Attachment for [% terms.Bug %] #[% bugid %][% END %] +[% title = BLOCK %]Create New Attachment for [% terms.Bug %] #[% bug.bug_id %][% END %] [% header = BLOCK %]Create New Attachment for - [%+ "$terms.Bug $bugid" FILTER bug_link(bugid) FILTER none %][% END %] -[% subheader = BLOCK %][% bugsummary FILTER html %][% END %] + [%+ "$terms.Bug $bug.bug_id" FILTER bug_link(bug.bug_id) FILTER none %][% END %] +[% subheader = BLOCK %][% bug.short_desc FILTER html %][% END %] [% PROCESS global/header.html.tmpl title = title @@ -40,7 +40,7 @@ %]

    - + @@ -66,7 +66,7 @@ - [% IF (user.id != bugassignee_id) AND user.groups.editbugs %] + [% IF (user.id != bug.assigned_to.id) AND user.in_group("editbugs", bug.product_id) %] - [% IF user.in_group('editbugs') %] + [% IF user.in_group('editbugs', product.id) %] [% IF use_keywords %]
    Reassignment: diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl index 62f8004f2..c27750e6c 100644 --- a/template/en/default/bug/create/create.html.tmpl +++ b/template/en/default/bug/create/create.html.tmpl @@ -476,7 +476,7 @@ function handleWantsAttachment(wants_attachment) {
    diff --git a/template/en/default/filterexceptions.pl b/template/en/default/filterexceptions.pl index f8590fc28..ea5896730 100644 --- a/template/en/default/filterexceptions.pl +++ b/template/en/default/filterexceptions.pl @@ -424,7 +424,7 @@ ], 'attachment/create.html.tmpl' => [ - 'bugid', + 'bug.bug_id', 'attachment.id', ], diff --git a/template/en/default/global/site-navigation.html.tmpl b/template/en/default/global/site-navigation.html.tmpl index cb57df610..7c2eabecf 100644 --- a/template/en/default/global/site-navigation.html.tmpl +++ b/template/en/default/global/site-navigation.html.tmpl @@ -111,8 +111,8 @@ href="editparams.cgi">' IF user.groups.tweakparams %] [% '' IF user.groups.editusers %] - [% '' IF user.groups.editcomponents %] + [% '' + IF user.groups.editcomponents || user.get_products_by_permission("editcomponents").size %] [% '' IF user.groups.editcomponents %] [% '[% sep %]Classifications [% sep = "| " %] [% END %] - [% IF user.groups.editcomponents %] + [% IF user.groups.editcomponents || user.get_products_by_permission("editcomponents").size %]
  • [% sep %]Products
  • [% sep = "| " %] + [% END %] + [% IF user.groups.editcomponents %]
  • [% sep %]Flags
  • + [% sep = "| " %] [% END %] [% IF user.groups.admin %]
  • [% sep %]Custom Fields
  • diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 6fc244fb5..d6b596ea5 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -917,11 +917,11 @@ [% title = "Missing Component" %] [% admindocslinks = {'products.html' => 'Administering products', 'components.html' => 'Creating a component'} %] - Sorry, the product [% product FILTER html %] + Sorry, the product [% product.name FILTER html %] has to have at least one component in order for you to enter [% terms.abug %] into it.
    - [% IF user.in_group("editcomponents") %] - Create + [% IF user.in_group("editcomponents", product.id) %] + Create a new component. [% ELSE %] Please contact [% Param("maintainer") %] and ask them @@ -989,11 +989,11 @@ [% ELSIF error == "missing_version" %] [% title = "Missing Version" %] [% admindocslinks = {'versions.html' => 'Defining versions'} %] - Sorry, the product [% product FILTER html %] + Sorry, the product [% product.name FILTER html %] has to have at least one version in order for you to enter [% terms.abug %] into it.

    - [% IF user.in_group("editcomponents") %] - Create + [% IF user.in_group("editcomponents", product.id) %] + Create a new version. [% ELSE %] Please contact [% Param("maintainer") %] and ask them @@ -1213,7 +1213,7 @@ [% title = BLOCK %]Product closed for [% terms.Bugs %] Entry[% END %] [% admindocslinks = {'products.html' => 'Administering products'} %] Sorry, entering [% terms.bugs %] into the - product [% product FILTER html %] has been disabled. + product [% product.name FILTER html %] has been disabled. [% ELSIF error == "product_edit_denied" %] [% title = "Product Edit Access Denied" %] -- cgit v1.2.3-24-g4f1b