Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
dd80a671
You need to sign in or sign up before continuing.
Commit
dd80a671
authored
May 24, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 556407: Move the code for setting product and checking strict_isolation
from process_bug.cgi into Bugzilla::Bug::set_all
parent
7d308032
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
37 deletions
+30
-37
Bug.pm
Bugzilla/Bug.pm
+26
-7
process_bug.cgi
process_bug.cgi
+4
-30
No files found.
Bugzilla/Bug.pm
View file @
dd80a671
...
@@ -1890,6 +1890,13 @@ sub set_all {
...
@@ -1890,6 +1890,13 @@ sub set_all {
my
$self
=
shift
;
my
$self
=
shift
;
my
(
$params
)
=
@_
;
my
(
$params
)
=
@_
;
# For security purposes, and because lots of other checks depend on it,
# we set the product first before anything else.
my
$product_changed
;
# Used only for strict_isolation checks.
if
(
exists
$params
->
{
'product'
})
{
$product_changed
=
$self
->
_set_product
(
$params
->
{
'product'
},
$params
);
}
# strict_isolation checks mean that we should set the groups
# strict_isolation checks mean that we should set the groups
# immediately after changing the product.
# immediately after changing the product.
$self
->
_add_remove
(
$params
,
'groups'
);
$self
->
_add_remove
(
$params
,
'groups'
);
...
@@ -1960,6 +1967,14 @@ sub set_all {
...
@@ -1960,6 +1967,14 @@ sub set_all {
}
}
$self
->
_add_remove
(
$params
,
'cc'
);
$self
->
_add_remove
(
$params
,
'cc'
);
# Theoretically you could move a product without ever specifying
# a new assignee or qa_contact, or adding/removing any CCs. So,
# we have to check that the current assignee, qa, and CCs are still
# valid if we've switched products, under strict_isolation. We can only
# do that here, because if they *did* change the assignee, qa, or CC,
# then we don't want to check the original ones, only the new ones.
$self
->
_check_strict_isolation
()
if
$product_changed
;
}
}
# Helper for set_all that helps with fields that have an "add/remove"
# Helper for set_all that helps with fields that have an "add/remove"
...
@@ -2089,7 +2104,9 @@ sub set_flags {
...
@@ -2089,7 +2104,9 @@ sub set_flags {
sub
set_op_sys
{
$_
[
0
]
->
set
(
'op_sys'
,
$_
[
1
]);
}
sub
set_op_sys
{
$_
[
0
]
->
set
(
'op_sys'
,
$_
[
1
]);
}
sub
set_platform
{
$_
[
0
]
->
set
(
'rep_platform'
,
$_
[
1
]);
}
sub
set_platform
{
$_
[
0
]
->
set
(
'rep_platform'
,
$_
[
1
]);
}
sub
set_priority
{
$_
[
0
]
->
set
(
'priority'
,
$_
[
1
]);
}
sub
set_priority
{
$_
[
0
]
->
set
(
'priority'
,
$_
[
1
]);
}
sub
set_product
{
# For security reasons, you have to use set_all to change the product.
# See the strict_isolation check in set_all for an explanation.
sub
_set_product
{
my
(
$self
,
$name
,
$params
)
=
@_
;
my
(
$self
,
$name
,
$params
)
=
@_
;
my
$old_product
=
$self
->
product_obj
;
my
$old_product
=
$self
->
product_obj
;
my
$product
=
$self
->
_check_product
(
$name
);
my
$product
=
$self
->
_check_product
(
$name
);
...
@@ -2107,9 +2124,10 @@ sub set_product {
...
@@ -2107,9 +2124,10 @@ sub set_product {
}
}
$params
||=
{};
$params
||=
{};
my
$comp_name
=
$params
->
{
component
}
||
$self
->
component
;
# We delete these so that they're not set again later in set_all.
my
$vers_name
=
$params
->
{
version
}
||
$self
->
version
;
my
$comp_name
=
delete
$params
->
{
component
}
||
$self
->
component
;
my
$tm_name
=
$params
->
{
target_milestone
};
my
$vers_name
=
delete
$params
->
{
version
}
||
$self
->
version
;
my
$tm_name
=
delete
$params
->
{
target_milestone
};
# This way, if usetargetmilestone is off and we've changed products,
# This way, if usetargetmilestone is off and we've changed products,
# set_target_milestone will reset our target_milestone to
# set_target_milestone will reset our target_milestone to
# $product->default_milestone. But if we haven't changed products,
# $product->default_milestone. But if we haven't changed products,
...
@@ -2141,7 +2159,7 @@ sub set_product {
...
@@ -2141,7 +2159,7 @@ sub set_product {
undef
$@
;
undef
$@
;
Bugzilla
->
error_mode
(
$old_error_mode
);
Bugzilla
->
error_mode
(
$old_error_mode
);
my
$verified
=
$params
->
{
change_confirmed
};
my
$verified
=
$params
->
{
product_
change_confirmed
};
my
%
vars
;
my
%
vars
;
if
(
!
$verified
||
!
$component_ok
||
!
$version_ok
||
!
$milestone_ok
)
{
if
(
!
$verified
||
!
$component_ok
||
!
$version_ok
||
!
$milestone_ok
)
{
$vars
{
defaults
}
=
{
$vars
{
defaults
}
=
{
...
@@ -2195,7 +2213,9 @@ sub set_product {
...
@@ -2195,7 +2213,9 @@ sub set_product {
# just die if any of these are invalid.
# just die if any of these are invalid.
$self
->
set_component
(
$comp_name
);
$self
->
set_component
(
$comp_name
);
$self
->
set_version
(
$vers_name
);
$self
->
set_version
(
$vers_name
);
if
(
$product_changed
&&
!
$self
->
check_can_change_field
(
'target_milestone'
,
0
,
1
))
{
if
(
$product_changed
and
!
$self
->
check_can_change_field
(
'target_milestone'
,
0
,
1
))
{
# Have to set this directly to bypass the validators.
# Have to set this directly to bypass the validators.
$self
->
{
target_milestone
}
=
$product
->
default_milestone
;
$self
->
{
target_milestone
}
=
$product
->
default_milestone
;
}
}
...
@@ -2223,7 +2243,6 @@ sub set_product {
...
@@ -2223,7 +2243,6 @@ sub set_product {
}
}
}
}
# XXX This is temporary until all of process_bug uses update();
return
$product_changed
;
return
$product_changed
;
}
}
...
...
process_bug.cgi
View file @
dd80a671
...
@@ -239,22 +239,6 @@ foreach my $bug (@bug_objects) {
...
@@ -239,22 +239,6 @@ foreach my $bug (@bug_objects) {
}
}
}
}
# For security purposes, and because lots of other checks depend on it,
# we set the product first before anything else.
my
$product_change
;
# Used only for strict_isolation checks, right now.
if
(
should_set
(
'product'
))
{
foreach
my
$b
(
@bug_objects
)
{
my
$changed
=
$b
->
set_product
(
scalar
$cgi
->
param
(
'product'
),
{
component
=>
scalar
$cgi
->
param
(
'component'
),
version
=>
scalar
$cgi
->
param
(
'version'
),
target_milestone
=>
scalar
$cgi
->
param
(
'target_milestone'
),
change_confirmed
=>
scalar
$cgi
->
param
(
'confirm_product_change'
),
other_bugs
=>
\
@bug_objects
,
});
$product_change
||=
$changed
;
}
}
# Component, target_milestone, and version are in here just in case
# Component, target_milestone, and version are in here just in case
# the 'product' field wasn't defined in the CGI. It doesn't hurt to set
# the 'product' field wasn't defined in the CGI. It doesn't hurt to set
# them twice.
# them twice.
...
@@ -264,7 +248,8 @@ my @set_fields = qw(op_sys rep_platform priority bug_severity
...
@@ -264,7 +248,8 @@ my @set_fields = qw(op_sys rep_platform priority bug_severity
deadline remaining_time estimated_time
deadline remaining_time estimated_time
work_time set_default_assignee set_default_qa_contact
work_time set_default_assignee set_default_qa_contact
keywords keywordaction
keywords keywordaction
cclist_accessible reporter_accessible)
;
cclist_accessible reporter_accessible
product confirm_product_change)
;
push
(
@set_fields
,
'assigned_to'
)
if
!
$cgi
->
param
(
'set_default_assignee'
);
push
(
@set_fields
,
'assigned_to'
)
if
!
$cgi
->
param
(
'set_default_assignee'
);
push
(
@set_fields
,
'qa_contact'
)
if
!
$cgi
->
param
(
'set_default_qa_contact'
);
push
(
@set_fields
,
'qa_contact'
)
if
!
$cgi
->
param
(
'set_default_qa_contact'
);
my
%
field_translation
=
(
my
%
field_translation
=
(
...
@@ -275,9 +260,10 @@ my %field_translation = (
...
@@ -275,9 +260,10 @@ my %field_translation = (
set_default_assignee
=>
'reset_assigned_to'
,
set_default_assignee
=>
'reset_assigned_to'
,
set_default_qa_contact
=>
'reset_qa_contact'
,
set_default_qa_contact
=>
'reset_qa_contact'
,
keywordaction
=>
'keywords_action'
,
keywordaction
=>
'keywords_action'
,
confirm_product_change
=>
'product_change_confirmed'
,
);
);
my
%
set_all_fields
;
my
%
set_all_fields
=
(
other_bugs
=>
\
@bug_objects
)
;
foreach
my
$field_name
(
@set_fields
)
{
foreach
my
$field_name
(
@set_fields
)
{
if
(
should_set
(
$field_name
,
1
))
{
if
(
should_set
(
$field_name
,
1
))
{
my
$param_name
=
$field_translation
{
$field_name
}
||
$field_name
;
my
$param_name
=
$field_translation
{
$field_name
}
||
$field_name
;
...
@@ -402,18 +388,6 @@ if (defined $cgi->param('id')) {
...
@@ -402,18 +388,6 @@ if (defined $cgi->param('id')) {
$first_bug
->
set_flags
(
$flags
,
$new_flags
);
$first_bug
->
set_flags
(
$flags
,
$new_flags
);
}
}
foreach
my
$b
(
@bug_objects
)
{
# Theoretically you could move a product without ever specifying
# a new assignee or qa_contact, or adding/removing any CCs. So,
# we have to check that the current assignee, qa, and CCs are still
# valid if we've switched products, under strict_isolation. We can only
# do that here. There ought to be some better way to do this,
# architecturally, but I haven't come up with it.
if
(
$product_change
)
{
$b
->
_check_strict_isolation
();
}
}
my
$move_action
=
$cgi
->
param
(
'action'
)
||
''
;
my
$move_action
=
$cgi
->
param
(
'action'
)
||
''
;
if
(
$move_action
eq
Bugzilla
->
params
->
{
'move-button-text'
})
{
if
(
$move_action
eq
Bugzilla
->
params
->
{
'move-button-text'
})
{
Bugzilla
->
params
->
{
'move-enabled'
}
||
ThrowUserError
(
"move_bugs_disabled"
);
Bugzilla
->
params
->
{
'move-enabled'
}
||
ThrowUserError
(
"move_bugs_disabled"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment