]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 28849: Block users from CCing other users if they do not have editbugs privs
authorByron Jones <bjones@mozilla.com>
Tue, 10 May 2011 05:47:46 +0000 (13:47 +0800)
committerByron Jones <bjones@mozilla.com>
Tue, 10 May 2011 05:47:46 +0000 (13:47 +0800)
r=LpSolit, a=LpSolit

Bugzilla/Bug.pm
template/en/default/bug/edit.html.tmpl
template/en/default/global/user-error.html.tmpl

index f3d635344b75a8750036acda8043d5daa84d881d..4f5c0f236fef77417427568b8bf58295cb6f58ee 100644 (file)
@@ -2658,6 +2658,10 @@ sub remove_cc {
     my ($self, $user_or_name) = @_;
     my $user = ref $user_or_name ? $user_or_name
                                  : Bugzilla::User->check($user_or_name);
+    my $currentUser = Bugzilla->user;
+    if (!$self->user->{'canedit'} && $user->id != $currentUser->id) {
+        ThrowUserError('cc_remove_denied');
+    }
     my $cc_users = $self->cc_users;
     @$cc_users = grep { $_->id != $user->id } @$cc_users;
 }
index 0aa5f80af6dd3964fdf4c797e069d5de968dc319..f64d589c92cda2dbecbee6b05acf37e85b77d2c5 100644 (file)
             </div>
           [% END %]
           [% IF bug.cc %]
-            <select id="cc" name="cc" multiple="multiple" size="5">
+            <select id="cc" multiple="multiple" size="5"
+              [% IF bug.user.canedit %]name="cc"[% END %]>
               [% FOREACH c = bug.cc %]
                 <option value="[% c FILTER email FILTER html %]">
                   [% c FILTER email FILTER html %]</option>
               [% END %]
             </select>
-            [% IF user.id %]
+            [% IF user.id && !bug.user.canedit %]
+              <input type="hidden" name="cc" value="[% user.login FILTER email FILTER html %]">
+            [% END %]
+            [% IF user.id AND (bug.user.canedit OR bug.cc.contains(user.login)) %]
               <br>
               <input type="checkbox" id="removecc" name="removecc">
-              [%%]<label for="removecc">Remove selected CCs</label>
+              <label for="removecc">
+                [% IF bug.user.canedit %]
+                  Remove selected CCs
+                [% ELSE %]
+                  Remove me from the CC list
+                [% END %]
+              </label>
               <br>
             [% END %]
           [% END %]
index 1dd747f30a2cbc63ff0d3b335cea0af44d124f21..52bacc4575355f5a53011e6ca6b6f73c62523b78 100644 (file)
                     'query.html#list' => "$terms.Bug lists"} %]
     You may not search, or create saved searches, without any search terms.
 
+  [% ELSIF error == "cc_remove_denied" %]
+    [% title = "Change Denied" %]
+    You do not have permission to remove other people from the CC list.
+
   [% ELSIF error == "chart_too_large" %]
     [% title = "Chart Too Large" %]
     Sorry, but 2000 x 2000 is the maximum size for a chart.