diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2015-12-18 12:50:05 +0100 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2015-12-18 12:50:05 +0100 |
commit | fbd124bfc141db9a6ad8f7b4734f0db6f9da2f5f (patch) | |
tree | 8e7e0b6f88d5e2d431a3aff8c0aa34839bd7493e /Bugzilla/API/1_0/Resource | |
parent | 21b3145e8195a91846e76bc0556da176bae6e79d (diff) | |
download | bugzilla-fbd124bfc141db9a6ad8f7b4734f0db6f9da2f5f.tar.gz bugzilla-fbd124bfc141db9a6ad8f7b4734f0db6f9da2f5f.tar.xz |
Bug 1232186: Component.update and Component.delete are broken
r=dkl
Diffstat (limited to 'Bugzilla/API/1_0/Resource')
-rw-r--r-- | Bugzilla/API/1_0/Resource/Component.pm | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Bugzilla/API/1_0/Resource/Component.pm b/Bugzilla/API/1_0/Resource/Component.pm index 96c2a3dcd..13a5f24b5 100644 --- a/Bugzilla/API/1_0/Resource/Component.pm +++ b/Bugzilla/API/1_0/Resource/Component.pm @@ -28,6 +28,8 @@ extends 'Bugzilla::API::1_0::Resource'; use constant PUBLIC_METHODS => qw( create + delete + update ); use constant CREATE_MAPPED_FIELDS => { @@ -129,7 +131,7 @@ sub _component_params_to_objects { # To get the component objects for product/component combination # first obtain the product object from the passed product name foreach my $name_hash (@{$params->{names}}) { - my $product = $user->can_admin_product($name_hash->{product}); + my $product = $user->check_can_admin_product($name_hash->{product}); push @components, @{ Bugzilla::Component->match({ product_id => $product->id, name => $name_hash->{component} @@ -157,9 +159,8 @@ sub _component_params_to_objects { sub update { my ($self, $params) = @_; my $dbh = Bugzilla->dbh; - my $user = Bugzilla->user; + my $user = Bugzilla->login(LOGIN_REQUIRED); - Bugzilla->login(LOGIN_REQUIRED); $user->in_group('editcomponents') || scalar @{ $user->get_products_by_permission('editcomponents') } || ThrowUserError("auth_failure", { group => "editcomponents", @@ -248,11 +249,9 @@ sub update { sub delete { my ($self, $params) = @_; - my $dbh = Bugzilla->dbh; - my $user = Bugzilla->user; + my $user = Bugzilla->login(LOGIN_REQUIRED); - Bugzilla->login(LOGIN_REQUIRED); $user->in_group('editcomponents') || scalar @{ $user->get_products_by_permission('editcomponents') } || ThrowUserError("auth_failure", { group => "editcomponents", |