summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-02-13 17:23:29 +0100
committerByron Jones <bjones@mozilla.com>2013-02-13 17:23:29 +0100
commit8076cbac92c228d086e84ebedef01dfff106cd62 (patch)
tree5c0661e1e874ad9386fd897e01ab58f4d58ee7c1 /Bugzilla
parent6beadee1270482d38ec4b500340af1b28df9b165 (diff)
downloadbugzilla-8076cbac92c228d086e84ebedef01dfff106cd62.tar.gz
bugzilla-8076cbac92c228d086e84ebedef01dfff106cd62.tar.xz
Bug 690833: Add the ability to restrict who can add comments to a bug report
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Bug.pm4
-rw-r--r--Bugzilla/Flag.pm6
2 files changed, 8 insertions, 2 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 0484ab8f4..3d3a92838 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -4029,8 +4029,8 @@ sub check_can_change_field {
return 1;
}
- # Allow anyone to change comments.
- if ($field =~ /^longdesc/) {
+ # Allow anyone to change comments, or set flags
+ if ($field =~ /^longdesc/ || $field eq 'flagtypes.name') {
return 1;
}
diff --git a/Bugzilla/Flag.pm b/Bugzilla/Flag.pm
index 0828ddc7c..2f6ee526f 100644
--- a/Bugzilla/Flag.pm
+++ b/Bugzilla/Flag.pm
@@ -312,6 +312,12 @@ sub set_flag {
ThrowCodeError('flag_unexpected_object', { 'caller' => ref $obj });
}
+ # Make sure the user can change flags
+ my $privs;
+ $bug->check_can_change_field('flagtypes.name', 0, 1, \$privs)
+ || ThrowUserError('illegal_change',
+ { field => 'flagtypes.name', privs => $privs });
+
# Update (or delete) an existing flag.
if ($params->{id}) {
my $flag = $class->check({ id => $params->{id} });