From 1c477cb4ac994ae9868c5b8ed5fc0b9e4c8a8696 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 21 May 2009 08:45:17 +0000 Subject: [PATCH] =?utf8?q?Bug=20339679:=20describecomponents.cgi=20doesn't?= =?utf8?q?=20show=20components=20of=20closed=20products,=20even=20when=20t?= =?utf8?q?here=20are=20bugs=20in=20these=20products=20-=20Patch=20by=20Fr?= =?utf8?q?=C3=83=C2=A9d=C3=83=C2=A9ric=20Buclin=20=20r?= =?utf8?q?=3Dghendricks=20a=3DLpSolit?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Bugzilla/User.pm | 20 ++++++++++++++++++++ describecomponents.cgi | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 603511910e..20f1707646 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -768,6 +768,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; @@ -1996,6 +2002,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 6d4722ad82..744501bbd0 100755 --- a/describecomponents.cgi +++ b/describecomponents.cgi @@ -44,7 +44,7 @@ Bugzilla->switch_to_shadow_db; 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}; -- 2.47.2