diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2010-07-07 03:58:10 +0200 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2010-07-07 03:58:10 +0200 |
commit | 814b24fdc9407a741967322041ff817665f8e00b (patch) | |
tree | 8137af19b7fbb04b8966c959f56b78be98b4e404 /Bugzilla/Product.pm | |
parent | ef414f2b12f7686ad830fb884f69865cdb41f6c0 (diff) | |
download | bugs-814b24fdc9407a741967322041ff817665f8e00b.tar bugs-814b24fdc9407a741967322041ff817665f8e00b.tar.gz bugs-814b24fdc9407a741967322041ff817665f8e00b.tar.bz2 bugs-814b24fdc9407a741967322041ff817665f8e00b.tar.xz bugs-814b24fdc9407a741967322041ff817665f8e00b.zip |
Bug 519835: Remove Bugzilla::Product::check_product() in favor of Bugzilla::Product->check()
r=mkanat a=LpSolit
Diffstat (limited to 'Bugzilla/Product.pm')
-rw-r--r-- | Bugzilla/Product.pm | 32 |
1 files changed, 7 insertions, 25 deletions
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<Bugzilla::Product::preload($products)>. -=item C<check_product($product_name)> - - 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 |