summaryrefslogtreecommitdiffstats
path: root/extensions/BMO
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2011-11-21 23:59:46 +0100
committerDave Lawrence <dlawrence@mozilla.com>2011-11-21 23:59:46 +0100
commit28aa3fa98db128c859407912a40dccc850d26ad5 (patch)
tree0453fbc6fb28b3e22000c130f38250b2a33c8b7a /extensions/BMO
parentd6b474c0ae7b03bbe7601bf091c833933a426c34 (diff)
downloadbugzilla-28aa3fa98db128c859407912a40dccc850d26ad5.tar.gz
bugzilla-28aa3fa98db128c859407912a40dccc850d26ad5.tar.xz
Bug 683031 - Creation of Employee Incident Reporting Form
Diffstat (limited to 'extensions/BMO')
-rw-r--r--extensions/BMO/Extension.pm58
-rw-r--r--extensions/BMO/lib/Data.pm1
2 files changed, 59 insertions, 0 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index 326af3644..c5fdfc393 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -800,4 +800,62 @@ sub mailer_before_send {
}
}
+sub post_bug_after_creation {
+ my ($self, $args) = @_;
+ my $vars = $args->{vars};
+ my $bug = $vars->{bug};
+ my $template = Bugzilla->template;
+
+ if (Bugzilla->input_params->{format}
+ && Bugzilla->input_params->{format} eq 'employee-incident'
+ && $bug->component eq 'Server Operations: Desktop Issues')
+ {
+ my $error_mode_cache = Bugzilla->error_mode;
+ Bugzilla->error_mode(ERROR_MODE_DIE);
+
+ my $new_bug;
+ eval {
+ my $old_user = Bugzilla->user;
+ Bugzilla->set_user(Bugzilla::User->new({ name => 'nobody@mozilla.org' }));
+ my $new_user = Bugzilla->user;
+
+ # HACK: User needs to be in the editbugs and primary bug's group to allow
+ # setting of dependencies.
+ $new_user->{'groups'} = [ Bugzilla::Group->new({ name => 'editbugs' }),
+ Bugzilla::Group->new({ name => 'infrasec' }) ];
+
+ my $comment;
+ $template->process('bug/create/comment-employee-incident.txt.tmpl', $vars, \$comment)
+ || ThrowTemplateError($template->error());
+
+ $new_bug = Bugzilla::Bug->create({
+ short_desc => 'Investigate Lost Device',
+ product => 'mozilla.org',
+ component => 'Infrastructure Security',
+ status_whiteboard => '[infrasec:incident]',
+ bug_severity => 'critical',
+ cc => [ 'mcoates@mozilla.com' ],
+ groups => [ 'infrasec' ],
+ comment => $comment,
+ op_sys => 'All',
+ rep_platform => 'All',
+ version => 'other',
+ dependson => $bug->bug_id,
+ });
+
+ my $recipients = { changer => $new_user };
+ Bugzilla::BugMail::Send($new_bug->id, $recipients);
+
+ Bugzilla->set_user($old_user);
+ };
+
+ Bugzilla->error_mode($error_mode_cache);
+
+ if ($@ || !$new_bug) {
+ warn "Failed to create secondary employee-incident bug: $@" if $@;
+ $vars->{'message'} = 'employee_incident_creation_failed';
+ }
+ }
+}
+
__PACKAGE__->NAME;
diff --git a/extensions/BMO/lib/Data.pm b/extensions/BMO/lib/Data.pm
index 0e2096e13..a09a23c92 100644
--- a/extensions/BMO/lib/Data.pm
+++ b/extensions/BMO/lib/Data.pm
@@ -237,6 +237,7 @@ our %always_fileable_group = (
'consulting' => 1,
'core-security' => 1,
'infra' => 1,
+ 'infrasec' => 1,
'marketing-private' => 1,
'mozilla-confidential' => 1,
'mozilla-corporation-confidential' => 1,