From 814b24fdc9407a741967322041ff817665f8e00b Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Wed, 7 Jul 2010 03:58:10 +0200 Subject: Bug 519835: Remove Bugzilla::Product::check_product() in favor of Bugzilla::Product->check() r=mkanat a=LpSolit --- Bugzilla/Product.pm | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'Bugzilla/Product.pm') diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm index 80e1752e6..e61b3b577 100644 --- a/Bugzilla/Product.pm +++ b/Bugzilla/Product.pm @@ -812,26 +812,17 @@ sub classification_id { return $_[0]->{'classification_id'}; } #### Subroutines ###### ############################### -sub check_product { - my ($product_name) = @_; - - unless ($product_name) { - ThrowUserError('product_not_specified'); - } - my $product = new Bugzilla::Product({name => $product_name}); - unless ($product) { - ThrowUserError('product_doesnt_exist', - {'product' => $product_name}); - } - return $product; -} - sub check { my ($class, $params) = @_; $params = { name => $params } if !ref $params; - $params->{_error} = 'product_access_denied'; + if (!$params->{allow_inaccessible}) { + $params->{_error} = 'product_access_denied'; + } my $product = $class->SUPER::check($params); - if (!Bugzilla->user->can_access_product($product)) { + + if (!$params->{allow_inaccessible} + && !Bugzilla->user->can_access_product($product)) + { ThrowUserError('product_access_denied', $params); } return $product; @@ -1052,15 +1043,6 @@ than calling those accessors on every item in the array individually. This function is not exported, so must be called like C. -=item C - - Description: Checks if the product name was passed in and if is a valid - product. - - Params: $product_name - String with a product name. - - Returns: Bugzilla::Product object. - =back =head1 SEE ALSO -- cgit v1.2.3-24-g4f1b