From: bugreport%peshkin.net <> Date: Tue, 3 Jan 2006 06:57:06 +0000 (+0000) Subject: Bug 313547: When strict_isolation is set, don't allow inappropriate users on new... X-Git-Tag: bugzilla-2.22rc1~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=972eed87eba7dafcf50b5cd9c8993735690807d9;p=thirdparty%2Fbugzilla.git Bug 313547: When strict_isolation is set, don't allow inappropriate users on new bugs Patch by Joel Peshkin r=lpsolit, a=justdave --- diff --git a/post_bug.cgi b/post_bug.cgi index 9645159267..3d2d6ab480 100755 --- a/post_bug.cgi +++ b/post_bug.cgi @@ -257,6 +257,28 @@ if ($cgi->param('keywords') && UserInGroup("editbugs")) { } } +if (Param("strict_isolation")) { + my @blocked_users = (); + my %related_users = %ccids; + $related_users{$cgi->param('assigned_to')} = 1; + if (Param('useqacontact') && $cgi->param('qa_contact')) { + $related_users{$cgi->param('qa_contact')} = 1; + } + foreach my $pid (keys %related_users) { + my $related_user = Bugzilla::User->new($pid); + if (!$related_user->can_edit_product($product_id)) { + push (@blocked_users, $related_user->login); + } + } + if (scalar(@blocked_users)) { + ThrowUserError("invalid_user_group", + {'users' => \@blocked_users, + 'new' => 1, + 'product' => $product + }); + } +} + # Check for valid dependency info. foreach my $field ("dependson", "blocked") { if (UserInGroup("editbugs") && $cgi->param($field)) { diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 4ff86c34a9..edacda0e12 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -685,6 +685,8 @@ [%+ field_descs.product FILTER html %] [% IF bug_id %] for [% terms.bug %] '[% bug_id FILTER html %]'. + [% ELSIF new %] + and may not be included on a new [% terms.bug %]. [% ELSE %] for at least one [% terms.bug %] being changed. [% END %]