From: lpsolit%gmail.com <> Date: Thu, 21 May 2009 08:47:19 +0000 (+0000) Subject: Bug 339679: describecomponents.cgi doesn't show components of closed products, even... X-Git-Tag: bugzilla-3.2.4~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=627dff8e4976f419ce7c736769ffd5b36147a3c6;p=thirdparty%2Fbugzilla.git Bug 339679: describecomponents.cgi doesn't show components of closed products, even when there are bugs in these products - Patch by Frédéric Buclin r=ghendricks a=LpSolit --- diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 41ded04679..6dbff8e439 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -751,6 +751,12 @@ sub get_enterable_products { return $self->{enterable_products}; } +sub can_access_product { + my ($self, $product_name) = @_; + + return scalar(grep {$_->name eq $product_name} @{$self->get_accessible_products}); +} + sub get_accessible_products { my $self = shift; @@ -1987,6 +1993,20 @@ method should be called in such a case to force reresolution of these groups. Returns: an array of product objects. +=item C + +Returns 1 if the user can search or enter bugs into the specified product, +and 0 if the user should not be aware of the existence of the product. + +=item C + + Description: Returns an array of product objects the user can search + or enter bugs against. + + Params: none + + Returns: an array of product objects. + =item C Description: Checks whether the user is allowed to administrate the product. diff --git a/describecomponents.cgi b/describecomponents.cgi index 8061837836..05bd4e59fc 100755 --- a/describecomponents.cgi +++ b/describecomponents.cgi @@ -43,7 +43,7 @@ print $cgi->header(); my $product_name = trim($cgi->param('product') || ''); my $product = new Bugzilla::Product({'name' => $product_name}); -unless ($product && $user->can_enter_product($product->name)) { +unless ($product && $user->can_access_product($product->name)) { # Products which the user is allowed to see. my @products = @{$user->get_enterable_products};