diff options
author | Byron Jones <bjones@mozilla.com> | 2012-07-24 10:54:01 +0200 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2012-07-24 10:54:01 +0200 |
commit | cfd67484c07a29617c3e35e03b90bdd3befc6dd7 (patch) | |
tree | afa8c64e2f79ddf156101a69758a907d49c42362 /extensions | |
parent | d60fcb5fdf1e208c46b807c4e91e05eb65307243 (diff) | |
download | bugzilla-cfd67484c07a29617c3e35e03b90bdd3befc6dd7.tar.gz bugzilla-cfd67484c07a29617c3e35e03b90bdd3befc6dd7.tar.xz |
Bug 772776: add a "visiblity group" for the partner-confidential group
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/BMO/Extension.pm | 24 | ||||
-rw-r--r-- | extensions/BMO/lib/Data.pm | 12 | ||||
-rw-r--r-- | extensions/BMO/template/en/default/hook/bug/create/create-form.html.tmpl | 38 |
3 files changed, 57 insertions, 17 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index b382e240d..d0c392cf0 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -47,13 +47,14 @@ use Bugzilla::Extension::BMO::Data qw($cf_visible_in_products $cf_flags $cf_project_flags $cf_disabled_flags - %group_to_cc_map + %group_change_notification $blocking_trusted_setters $blocking_trusted_requesters $status_trusted_wanters $status_trusted_setters $other_setters %always_fileable_group + %group_auto_cc %product_sec_groups); use Bugzilla::Extension::BMO::Reports qw(user_activity_report triage_reports @@ -349,8 +350,8 @@ sub _cc_if_special_group { return if !$group; - if (exists $group_to_cc_map{$group}) { - foreach my $login (@{ $group_to_cc_map{$group} }) { + if (exists $group_change_notification{$group}) { + foreach my $login (@{ $group_change_notification{$group} }) { my $id = login_to_id($login); $recipients->{$id}->{+REL_CC} = Bugzilla::BugMail::BIT_DIRECT(); } @@ -654,6 +655,23 @@ sub object_end_of_create_validators { } } +# Automatically CC users to bugs based on group & product +sub bug_end_of_create { + my ($self, $args) = @_; + my $bug = $args->{'bug'}; + + foreach my $group_name (keys %group_auto_cc) { + if ($bug->in_group(Bugzilla::Group->new({ name => $group_name }))) { + my $ra_logins = exists $group_auto_cc{$group_name}->{$bug->product} + ? $group_auto_cc{$group_name}->{$bug->product} + : $group_auto_cc{$group_name}->{'_default'}; + foreach my $login (@$ra_logins) { + $bug->add_cc($login); + } + } + } +} + sub install_before_final_checks { my ($self, $args) = @_; diff --git a/extensions/BMO/lib/Data.pm b/extensions/BMO/lib/Data.pm index 0f030a8a8..0f0fdbcca 100644 --- a/extensions/BMO/lib/Data.pm +++ b/extensions/BMO/lib/Data.pm @@ -29,13 +29,14 @@ use Tie::IxHash; our @EXPORT_OK = qw($cf_visible_in_products $cf_flags $cf_project_flags $cf_disabled_flags - %group_to_cc_map + %group_change_notification $blocking_trusted_setters $blocking_trusted_requesters $status_trusted_wanters $status_trusted_setters $other_setters %always_fileable_group + %group_auto_cc %product_sec_groups); # Which custom fields are visible in which products and components. @@ -255,7 +256,7 @@ our $cf_disabled_flags = [ ]; # Who to CC on particular bugmails when certain groups are added or removed. -our %group_to_cc_map = ( +our %group_change_notification = ( 'addons-security' => ['amo-editors@mozilla.org'], 'bugzilla-security' => ['security@bugzilla.org'], 'client-services-security' => ['amo-admins@mozilla.org', 'web-security@mozilla.org'], @@ -371,6 +372,13 @@ our %product_sec_groups = ( "_default" => 'core-security' ); +# Automatically CC users to bugs filed into configured groups and products +our %group_auto_cc = ( + 'partner-confidential' => { + '_default' => ['mbest@mozilla.com'], + }, +); + # Default security groups for products should always been fileable map { $always_fileable_group{$_} = 1 } values %product_sec_groups; diff --git a/extensions/BMO/template/en/default/hook/bug/create/create-form.html.tmpl b/extensions/BMO/template/en/default/hook/bug/create/create-form.html.tmpl index 1b1f1d67d..0a3b75262 100644 --- a/extensions/BMO/template/en/default/hook/bug/create/create-form.html.tmpl +++ b/extensions/BMO/template/en/default/hook/bug/create/create-form.html.tmpl @@ -2,17 +2,31 @@ <th>Security:</th> <td colspan="3"> [% sec_group = sec_groups.${product.name} || sec_groups._default %] - - <input type="checkbox" name="groups" - value="[% sec_group FILTER none %]" id="groups" - [% FOREACH g = group %] - [% IF g.name == sec_group %] - [% " checked=\"checked\"" IF g.checked %] - [% END %] - [% END %] - > - <label for="groups">Many users could be harmed by this security problem: - it should be kept hidden from the public until it is resolved.</label> - <br><br> + [% PROCESS group_checkbox + name = sec_group + desc = "Many users could be harmed by this security problem: " _ + "it should be kept hidden from the public until it is resolved." + %] + [% IF user.in_group('partner-confidential-visible') %] + [% PROCESS group_checkbox + name = 'partner-confidential' + desc = "Restrict the visiblity of this " _ terms.bug _ " to " _ + "the assignee, QA contact, and CC list only." + %] + [% END %] + <br> </td> </tr> + +[% BLOCK group_checkbox %] + <input type="checkbox" name="groups" + value="[% name FILTER none %]" id="group_[% name FILTER html %]" + [% FOREACH g = group %] + [% IF g.name == name %] + [% ' checked="checked"' IF g.checked %] + [% LAST %] + [% END %] + [% END %] + > + <label for="group_[% name FILTER html %]">[% desc FILTER html %]</label><br> +[% END %] |