Commit 4f4c25bb authored by travis%sedsystems.ca's avatar travis%sedsystems.ca

Bug 266579 : Users without privs can confirm bugs by assigning to themselves…

Bug 266579 : Users without privs can confirm bugs by assigning to themselves first, without having canconfirm privs Patch by LpSolit@gmail.com r=myk a=justdave
parent 61a49f22
...@@ -404,20 +404,22 @@ sub user { ...@@ -404,20 +404,22 @@ sub user {
# Display everything as if they have all the permissions in the # Display everything as if they have all the permissions in the
# world; their permissions will get checked when they log in and # world; their permissions will get checked when they log in and
# actually try to make the change. # actually try to make the change.
my $privileged = (!Bugzilla->user->id) my $unknown_privileges = !Bugzilla->user->id
|| Bugzilla->user->in_group("editbugs") || Bugzilla->user->in_group("editbugs");
|| Bugzilla->user->id == $self->{'assigned_to'}{'id'} my $canedit = $unknown_privileges
|| (Param('useqacontact') && $self->{'qa_contact'} && || Bugzilla->user->id == $self->{'assigned_to'}{'id'}
Bugzilla->user->id == $self->{'qa_contact'}{'id'}); || (Param('useqacontact')
my $isreporter = Bugzilla->user->id && && $self->{'qa_contact'}
Bugzilla->user->id == $self->{'reporter'}{'id'}; && Bugzilla->user->id == $self->{'qa_contact'}{'id'});
my $canconfirm = $unknown_privileges
my $canedit = $privileged || $isreporter; || Bugzilla->user->in_group("canconfirm");
my $canconfirm = $privileged || Bugzilla->user->in_group("canconfirm"); my $isreporter = Bugzilla->user->id
&& Bugzilla->user->id == $self->{'reporter'}{'id'};
$self->{'user'} = {canmove => $canmove,
canconfirm => $canconfirm, $self->{'user'} = {canmove => $canmove,
canedit => $canedit,}; canconfirm => $canconfirm,
canedit => $canedit,
isreporter => $isreporter};
return $self->{'user'}; return $self->{'user'};
} }
......
...@@ -317,7 +317,11 @@ $vars->{'component_'} = \@components; ...@@ -317,7 +317,11 @@ $vars->{'component_'} = \@components;
$default{'component_'} = formvalue('component'); $default{'component_'} = formvalue('component');
$vars->{'assigned_to'} = formvalue('assigned_to'); $vars->{'assigned_to'} = formvalue('assigned_to');
$vars->{'assigned_to_disabled'} = !UserInGroup('editbugs');
$vars->{'cc'} = formvalue('cc'); $vars->{'cc'} = formvalue('cc');
$vars->{'cc_disabled'} = 0;
$vars->{'product'} = $product; $vars->{'product'} = $product;
$vars->{'bug_file_loc'} = formvalue('bug_file_loc', "http://"); $vars->{'bug_file_loc'} = formvalue('bug_file_loc', "http://");
$vars->{'short_desc'} = formvalue('short_desc'); $vars->{'short_desc'} = formvalue('short_desc');
......
...@@ -130,7 +130,7 @@ my $sql_product = SqlQuote($::FORM{'product'}); ...@@ -130,7 +130,7 @@ my $sql_product = SqlQuote($::FORM{'product'});
my $sql_component = SqlQuote($::FORM{'component'}); my $sql_component = SqlQuote($::FORM{'component'});
# Default assignee is the component owner. # Default assignee is the component owner.
if ($::FORM{'assigned_to'} eq "") { if (!UserInGroup("editbugs") || $::FORM{'assigned_to'} eq "") {
SendSQL("SELECT initialowner FROM components " . SendSQL("SELECT initialowner FROM components " .
"WHERE id = $component_id"); "WHERE id = $component_id");
$::FORM{'assigned_to'} = FetchOneColumn(); $::FORM{'assigned_to'} = FetchOneColumn();
......
...@@ -187,6 +187,7 @@ function set_assign_to() { ...@@ -187,6 +187,7 @@ function set_assign_to() {
[% INCLUDE global/userselect.html.tmpl [% INCLUDE global/userselect.html.tmpl
name => "assigned_to" name => "assigned_to"
value => assigned_to value => assigned_to
disabled => assigned_to_disabled
size => 32 size => 32
emptyok => 1 emptyok => 1
%] %]
...@@ -200,6 +201,7 @@ function set_assign_to() { ...@@ -200,6 +201,7 @@ function set_assign_to() {
[% INCLUDE global/userselect.html.tmpl [% INCLUDE global/userselect.html.tmpl
name => "cc" name => "cc"
value => cc value => cc
disabled => cc_disabled
size => 45 size => 45
emptyok => 1 emptyok => 1
multiple => 5 multiple => 5
......
...@@ -43,19 +43,20 @@ ...@@ -43,19 +43,20 @@
[% knum = knum + 1 %] [% knum = knum + 1 %]
[% END %] [% END %]
[% IF bug.user.canedit %] [% IF bug.isopened && bug.bug_status != "ASSIGNED" && bug.user.canedit
[% IF bug.isopened %] && (!bug.isunconfirmed || bug.user.canconfirm) %]
[% IF bug.bug_status != "ASSIGNED" && bug.user.canconfirm %] <input type="radio" id="knob-accept" name="knob" value="accept">
<input type="radio" id="knob-accept" name="knob" value="accept"> <label for="knob-accept">
<label for="knob-accept"> Accept [% terms.bug %] (
Accept [% terms.bug %] ( [% IF bug.isunconfirmed %]confirm [% terms.bug %], [% END %]change
[% IF bug.isunconfirmed %]confirm [% terms.bug %], [% END %]change status to <b>ASSIGNED</b>)
status to <b>ASSIGNED</b>) </label>
</label> <br>
<br> [% knum = knum + 1 %]
[% knum = knum + 1 %] [% END %]
[% END %]
[% IF bug.user.canedit || bug.user.isreporter %]
[% IF bug.isopened %]
[% IF bug.resolution %] [% IF bug.resolution %]
<input type="radio" id="knob-clear" name="knob" value="clearresolution"> <input type="radio" id="knob-clear" name="knob" value="clearresolution">
<label for="knob-clear"> <label for="knob-clear">
...@@ -90,45 +91,47 @@ ...@@ -90,45 +91,47 @@
<br> <br>
[% knum = knum + 1 %] [% knum = knum + 1 %]
<input type="radio" id="knob-reassign" name="knob" value="reassign"> [% IF bug.user.canedit %]
<label for="knob-reassign"> <input type="radio" id="knob-reassign" name="knob" value="reassign">
<a href="page.cgi?id=fields.html#assigned_to">Reassign</a> <label for="knob-reassign">
[% terms.bug %] to <a href="page.cgi?id=fields.html#assigned_to">Reassign</a>
</label> [% terms.bug %] to
[% safe_assigned_to = FILTER js; bug.assigned_to.login; END %]
[% INCLUDE global/userselect.html.tmpl
name => "assigned_to"
value => bug.assigned_to.login
size => 32
onchange => "if ((this.value != '$safe_assigned_to') && (this.value != '')) {
document.changeform.knob[$knum].checked=true;
}"
%]
<br>
[% IF bug.isunconfirmed && bug.user.canconfirm %]
&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="andconfirm" name="andconfirm">
<label for="andconfirm">
and confirm [% terms.bug %] (change status to <b>NEW</b>)
</label> </label>
[% safe_assigned_to = FILTER js; bug.assigned_to.login; END %]
[% INCLUDE global/userselect.html.tmpl
name => "assigned_to"
value => bug.assigned_to.login
size => 32
onchange => "if ((this.value != '$safe_assigned_to') && (this.value != '')) {
document.changeform.knob[$knum].checked=true;
}"
%]
<br> <br>
[% END %] [% IF bug.isunconfirmed && bug.user.canconfirm %]
[% knum = knum + 1 %] &nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="andconfirm" name="andconfirm">
<label for="andconfirm">
and confirm [% terms.bug %] (change status to <b>NEW</b>)
</label>
<br>
[% END %]
[% knum = knum + 1 %]
<input type="radio" id="knob-reassign-cmp" name="knob" value="reassignbycomponent"> <input type="radio" id="knob-reassign-cmp" name="knob" value="reassignbycomponent">
<label for="knob-reassign-cmp"> <label for="knob-reassign-cmp">
Reassign [% terms.bug %] to owner Reassign [% terms.bug %] to owner
[% " and QA contact" IF Param('useqacontact') %] [% " and QA contact" IF Param('useqacontact') %]
of selected component of selected component
</label>
<br>
[% IF bug.isunconfirmed && bug.user.canconfirm %]
&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="compconfirm" name="compconfirm">
<label for="compconfirm">
and confirm [% terms.bug %] (change status to <b>NEW</b>)
</label> </label>
<br> <br>
[% IF bug.isunconfirmed && bug.user.canconfirm %]
&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="compconfirm" name="compconfirm">
<label for="compconfirm">
and confirm [% terms.bug %] (change status to <b>NEW</b>)
</label>
<br>
[% END %]
[% knum = knum + 1 %]
[% END %] [% END %]
[% knum = knum + 1 %]
[% ELSE %] [% ELSE %]
[% IF bug.resolution != "MOVED" || [% IF bug.resolution != "MOVED" ||
(bug.resolution == "MOVED" && bug.user.canmove) %] (bug.resolution == "MOVED" && bug.user.canmove) %]
......
...@@ -436,10 +436,14 @@ ...@@ -436,10 +436,14 @@
You tried to change the You tried to change the
<strong>[% field_descs.$field FILTER html %]</strong> field <strong>[% field_descs.$field FILTER html %]</strong> field
from <em>[% oldvalue FILTER html %]</em> to from <em>[% oldvalue FILTER html %]</em> to
<em>[% newvalue FILTER html %]</em>, <em>[% newvalue FILTER html %]</em>, but only
but only the owner or submitter of the [% terms.bug %], or a [% IF privs < 3 %]
sufficiently empowered user, may change that field. the owner
[% IF privs < 2 %] or reporter [% END %]
of the [% terms.bug %], or
[% END %]
a sufficiently empowered user may change that field.
[% ELSIF error == "illegal_changed_in_last_x_days" %] [% ELSIF error == "illegal_changed_in_last_x_days" %]
[% title = "Your Search Makes No Sense" %] [% title = "Your Search Makes No Sense" %]
The <em>Changed in last ___ days</em> field must be a simple number. The <em>Changed in last ___ days</em> field must be a simple number.
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
# name: mandatory; field name # name: mandatory; field name
# value: optional; default field value/selection # value: optional; default field value/selection
# onchange: optional; onchange attribute value # onchange: optional; onchange attribute value
# disabled: optional; if true, the field is disabled
# accesskey: optional, input only; accesskey attribute value # accesskey: optional, input only; accesskey attribute value
# size: optional, input only; size attribute value # size: optional, input only; size attribute value
# emptyok: optional, select only; if true, prepend menu option to start of select # emptyok: optional, select only; if true, prepend menu option to start of select
...@@ -30,6 +31,7 @@ ...@@ -30,6 +31,7 @@
[% IF Param("usemenuforusers") %] [% IF Param("usemenuforusers") %]
<select name="[% name FILTER html %]" <select name="[% name FILTER html %]"
[% IF onchange %] onchange="[% onchange FILTER html %]" [% END %] [% IF onchange %] onchange="[% onchange FILTER html %]" [% END %]
[% IF disabled %] disabled="[% disabled FILTER html %]" [% END %]
[% IF accesskey %] accesskey="[% accesskey FILTER html %]" [% END %] [% IF accesskey %] accesskey="[% accesskey FILTER html %]" [% END %]
[% IF multiple %] multiple="multiple" size="[% multiple FILTER html %]" [% END %] [% IF multiple %] multiple="multiple" size="[% multiple FILTER html %]" [% END %]
> >
...@@ -48,9 +50,10 @@ ...@@ -48,9 +50,10 @@
<input <input
name="[% name FILTER html %]" name="[% name FILTER html %]"
value="[% value FILTER html %]" value="[% value FILTER html %]"
[% IF onchange %] onchange="[% onchange FILTER html %]" [% END %]
[% IF disabled %] disabled="[% disabled FILTER html %]" [% END %]
[% IF accesskey %] accesskey="[% accesskey FILTER html %]" [% END %] [% IF accesskey %] accesskey="[% accesskey FILTER html %]" [% END %]
[% IF size %] size="[% size FILTER html %]" [% END %] [% IF size %] size="[% size FILTER html %]" [% END %]
[% IF onchange %] onchange="[% onchange FILTER html %]" [% END %]
> >
[% END %] [% END %]
......
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