Commit 80433668 authored by Byron Jones's avatar Byron Jones

Bug 28849: Block users from CCing other users if they do not have editbugs privs

r=LpSolit, a=LpSolit
parent 12a41578
...@@ -2658,6 +2658,10 @@ sub remove_cc { ...@@ -2658,6 +2658,10 @@ sub remove_cc {
my ($self, $user_or_name) = @_; my ($self, $user_or_name) = @_;
my $user = ref $user_or_name ? $user_or_name my $user = ref $user_or_name ? $user_or_name
: Bugzilla::User->check($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; my $cc_users = $self->cc_users;
@$cc_users = grep { $_->id != $user->id } @$cc_users; @$cc_users = grep { $_->id != $user->id } @$cc_users;
} }
......
...@@ -830,16 +830,26 @@ ...@@ -830,16 +830,26 @@
</div> </div>
[% END %] [% END %]
[% IF bug.cc %] [% 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 %] [% FOREACH c = bug.cc %]
<option value="[% c FILTER email FILTER html %]"> <option value="[% c FILTER email FILTER html %]">
[% c FILTER email FILTER html %]</option> [% c FILTER email FILTER html %]</option>
[% END %] [% END %]
</select> </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> <br>
<input type="checkbox" id="removecc" name="removecc"> <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> <br>
[% END %] [% END %]
[% END %] [% END %]
......
...@@ -280,6 +280,10 @@ ...@@ -280,6 +280,10 @@
'query.html#list' => "$terms.Bug lists"} %] 'query.html#list' => "$terms.Bug lists"} %]
You may not search, or create saved searches, without any search terms. 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" %] [% ELSIF error == "chart_too_large" %]
[% title = "Chart Too Large" %] [% title = "Chart Too Large" %]
Sorry, but 2000 x 2000 is the maximum size for a chart. Sorry, but 2000 x 2000 is the maximum size for a chart.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment