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
fbd124bf
Commit
fbd124bf
authored
Dec 18, 2015
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1232186: Component.update and Component.delete are broken
r=dkl
parent
21b3145e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
Component.pm
Bugzilla/API/1_0/Resource/Component.pm
+5
-6
Component.pm
Bugzilla/WebService/Component.pm
+5
-6
No files found.
Bugzilla/API/1_0/Resource/Component.pm
View file @
fbd124bf
...
@@ -28,6 +28,8 @@ extends 'Bugzilla::API::1_0::Resource';
...
@@ -28,6 +28,8 @@ extends 'Bugzilla::API::1_0::Resource';
use
constant
PUBLIC_METHODS
=>
qw(
use
constant
PUBLIC_METHODS
=>
qw(
create
create
delete
update
)
;
)
;
use
constant
CREATE_MAPPED_FIELDS
=>
{
use
constant
CREATE_MAPPED_FIELDS
=>
{
...
@@ -129,7 +131,7 @@ sub _component_params_to_objects {
...
@@ -129,7 +131,7 @@ sub _component_params_to_objects {
# To get the component objects for product/component combination
# To get the component objects for product/component combination
# first obtain the product object from the passed product name
# first obtain the product object from the passed product name
foreach
my
$name_hash
(
@
{
$params
->
{
names
}})
{
foreach
my
$name_hash
(
@
{
$params
->
{
names
}})
{
my
$product
=
$user
->
can_admin_product
(
$name_hash
->
{
product
});
my
$product
=
$user
->
c
heck_c
an_admin_product
(
$name_hash
->
{
product
});
push
@components
,
@
{
Bugzilla::
Component
->
match
({
push
@components
,
@
{
Bugzilla::
Component
->
match
({
product_id
=>
$product
->
id
,
product_id
=>
$product
->
id
,
name
=>
$name_hash
->
{
component
}
name
=>
$name_hash
->
{
component
}
...
@@ -157,9 +159,8 @@ sub _component_params_to_objects {
...
@@ -157,9 +159,8 @@ sub _component_params_to_objects {
sub
update
{
sub
update
{
my
(
$self
,
$params
)
=
@_
;
my
(
$self
,
$params
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$user
=
Bugzilla
->
user
;
my
$user
=
Bugzilla
->
login
(
LOGIN_REQUIRED
)
;
Bugzilla
->
login
(
LOGIN_REQUIRED
);
$user
->
in_group
(
'editcomponents'
)
$user
->
in_group
(
'editcomponents'
)
||
scalar
@
{
$user
->
get_products_by_permission
(
'editcomponents'
)
}
||
scalar
@
{
$user
->
get_products_by_permission
(
'editcomponents'
)
}
||
ThrowUserError
(
"auth_failure"
,
{
group
=>
"editcomponents"
,
||
ThrowUserError
(
"auth_failure"
,
{
group
=>
"editcomponents"
,
...
@@ -248,11 +249,9 @@ sub update {
...
@@ -248,11 +249,9 @@ sub update {
sub
delete
{
sub
delete
{
my
(
$self
,
$params
)
=
@_
;
my
(
$self
,
$params
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$user
=
Bugzilla
->
user
;
my
$user
=
Bugzilla
->
login
(
LOGIN_REQUIRED
)
;
Bugzilla
->
login
(
LOGIN_REQUIRED
);
$user
->
in_group
(
'editcomponents'
)
$user
->
in_group
(
'editcomponents'
)
||
scalar
@
{
$user
->
get_products_by_permission
(
'editcomponents'
)
}
||
scalar
@
{
$user
->
get_products_by_permission
(
'editcomponents'
)
}
||
ThrowUserError
(
"auth_failure"
,
{
group
=>
"editcomponents"
,
||
ThrowUserError
(
"auth_failure"
,
{
group
=>
"editcomponents"
,
...
...
Bugzilla/WebService/Component.pm
View file @
fbd124bf
...
@@ -21,6 +21,8 @@ use Bugzilla::WebService::Util qw(translate params_to_objects validate);
...
@@ -21,6 +21,8 @@ use Bugzilla::WebService::Util qw(translate params_to_objects validate);
use
constant
PUBLIC_METHODS
=>
qw(
use
constant
PUBLIC_METHODS
=>
qw(
create
create
delete
update
)
;
)
;
use
constant
CREATE_MAPPED_FIELDS
=>
{
use
constant
CREATE_MAPPED_FIELDS
=>
{
...
@@ -78,7 +80,7 @@ sub _component_params_to_objects {
...
@@ -78,7 +80,7 @@ sub _component_params_to_objects {
# To get the component objects for product/component combination
# To get the component objects for product/component combination
# first obtain the product object from the passed product name
# first obtain the product object from the passed product name
foreach
my
$name_hash
(
@
{
$params
->
{
names
}})
{
foreach
my
$name_hash
(
@
{
$params
->
{
names
}})
{
my
$product
=
$user
->
can_admin_product
(
$name_hash
->
{
product
});
my
$product
=
$user
->
c
heck_c
an_admin_product
(
$name_hash
->
{
product
});
push
@components
,
@
{
Bugzilla::
Component
->
match
({
push
@components
,
@
{
Bugzilla::
Component
->
match
({
product_id
=>
$product
->
id
,
product_id
=>
$product
->
id
,
name
=>
$name_hash
->
{
component
}
name
=>
$name_hash
->
{
component
}
...
@@ -106,9 +108,8 @@ sub _component_params_to_objects {
...
@@ -106,9 +108,8 @@ sub _component_params_to_objects {
sub
update
{
sub
update
{
my
(
$self
,
$params
)
=
@_
;
my
(
$self
,
$params
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$user
=
Bugzilla
->
user
;
my
$user
=
Bugzilla
->
login
(
LOGIN_REQUIRED
)
;
Bugzilla
->
login
(
LOGIN_REQUIRED
);
$user
->
in_group
(
'editcomponents'
)
$user
->
in_group
(
'editcomponents'
)
||
scalar
@
{
$user
->
get_products_by_permission
(
'editcomponents'
)
}
||
scalar
@
{
$user
->
get_products_by_permission
(
'editcomponents'
)
}
||
ThrowUserError
(
"auth_failure"
,
{
group
=>
"editcomponents"
,
||
ThrowUserError
(
"auth_failure"
,
{
group
=>
"editcomponents"
,
...
@@ -197,11 +198,9 @@ sub update {
...
@@ -197,11 +198,9 @@ sub update {
sub
delete
{
sub
delete
{
my
(
$self
,
$params
)
=
@_
;
my
(
$self
,
$params
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$user
=
Bugzilla
->
user
;
my
$user
=
Bugzilla
->
login
(
LOGIN_REQUIRED
)
;
Bugzilla
->
login
(
LOGIN_REQUIRED
);
$user
->
in_group
(
'editcomponents'
)
$user
->
in_group
(
'editcomponents'
)
||
scalar
@
{
$user
->
get_products_by_permission
(
'editcomponents'
)
}
||
scalar
@
{
$user
->
get_products_by_permission
(
'editcomponents'
)
}
||
ThrowUserError
(
"auth_failure"
,
{
group
=>
"editcomponents"
,
||
ThrowUserError
(
"auth_failure"
,
{
group
=>
"editcomponents"
,
...
...
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