aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2009-10-30 01:01:22 +0000
committerlpsolit%gmail.com <>2009-10-30 01:01:22 +0000
commit145f177dace8458cfb725e4405da1c77f86786cf (patch)
tree62fbe01212f78d88cfad4044ca9c18005e661dc9
parent65d75763b90b9485b52f15e2938951ad0fbfaa21 (diff)
downloadbugs-145f177dace8458cfb725e4405da1c77f86786cf.tar
bugs-145f177dace8458cfb725e4405da1c77f86786cf.tar.gz
bugs-145f177dace8458cfb725e4405da1c77f86786cf.tar.bz2
bugs-145f177dace8458cfb725e4405da1c77f86786cf.tar.xz
bugs-145f177dace8458cfb725e4405da1c77f86786cf.zip
Bug 525252: editproducts.cgi should only list classifications in which there are products you can administer - Patch by Frédéric Buclin <LpSolit@gmail.com> r=ghendricks a=LpSolit
-rwxr-xr-xeditproducts.cgi14
1 files changed, 12 insertions, 2 deletions
diff --git a/editproducts.cgi b/editproducts.cgi
index eaef243fd..e1356abbc 100755
--- a/editproducts.cgi
+++ b/editproducts.cgi
@@ -80,8 +80,18 @@ if (Bugzilla->params->{'useclassification'}
&& !$classification_name
&& !$product_name)
{
- $vars->{'classifications'} = $user->in_group('editcomponents') ?
- [Bugzilla::Classification->get_all] : $user->get_selectable_classifications;
+ my $class;
+ if ($user->in_group('editcomponents')) {
+ $class = [Bugzilla::Classification->get_all];
+ }
+ else {
+ # Only keep classifications containing at least one product
+ # which you can administer.
+ my $products = $user->get_products_by_permission('editcomponents');
+ my %class_ids = map { $_->classification_id => 1 } @$products;
+ $class = Bugzilla::Classification->new_from_list([keys %class_ids]);
+ }
+ $vars->{'classifications'} = $class;
$template->process("admin/products/list-classifications.html.tmpl", $vars)
|| ThrowTemplateError($template->error());