Bug 830330: Make flags honour bug_check_can_change_field
r=dkl, a=LpSolit git-svn-id: svn://10.0.0.236/trunk@264729 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
ae669f8fb4
commit
351a87d6c2
@ -1 +1 @@
|
|||||||
8574
|
8575
|
||||||
@ -4085,8 +4085,8 @@ sub check_can_change_field {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow anyone to change comments.
|
# Allow anyone to change comments, or set flags
|
||||||
if ($field =~ /^longdesc/) {
|
if ($field =~ /^longdesc/ || $field eq 'flagtypes.name') {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -294,6 +294,12 @@ sub set_flag {
|
|||||||
ThrowCodeError('flag_unexpected_object', { 'caller' => ref $obj });
|
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.
|
# Update (or delete) an existing flag.
|
||||||
if ($params->{id}) {
|
if ($params->{id}) {
|
||||||
my $flag = $class->check({ id => $params->{id} });
|
my $flag = $class->check({ id => $params->{id} });
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
# defined by the Mozilla Public License, v. 2.0.
|
# defined by the Mozilla Public License, v. 2.0.
|
||||||
#%]
|
#%]
|
||||||
|
|
||||||
[% IF user.id AND !read_only_flags %]
|
[% IF user.id && !read_only_flags && bug.check_can_change_field('flagtypes.name', 0, 1) %]
|
||||||
|
|
||||||
[%# We list flags by looping twice over the flag types relevant for the bug.
|
[%# We list flags by looping twice over the flag types relevant for the bug.
|
||||||
# In the first loop, we display existing flags and then, for active types,
|
# In the first loop, we display existing flags and then, for active types,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user