]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 339679: describecomponents.cgi doesn't show components of closed products, even...
authorlpsolit%gmail.com <>
Thu, 21 May 2009 08:45:17 +0000 (08:45 +0000)
committerlpsolit%gmail.com <>
Thu, 21 May 2009 08:45:17 +0000 (08:45 +0000)
Bugzilla/User.pm
describecomponents.cgi

index 603511910e63abc2ebaa209173bb255525dd82d7..20f1707646f68e86902cf05c80c8e6f3cb502f5b 100644 (file)
@@ -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<can_access_product(product_name)>
+
+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<get_accessible_products>
+
+ 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<check_can_admin_product($product_name)>
 
  Description: Checks whether the user is allowed to administrate the product.
index 6d4722ad820acae38a4252ec6873af16e3f04215..744501bbd054182e0ea1282850bcd0b90913bfc5 100755 (executable)
@@ -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};