From: lpsolit%gmail.com <> Date: Fri, 30 Oct 2009 01:01:22 +0000 (+0000) Subject: Bug 525252: editproducts.cgi should only list classifications in which there are... X-Git-Tag: bugzilla-3.5.1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=145f177dace8458cfb725e4405da1c77f86786cf;p=thirdparty%2Fbugzilla.git Bug 525252: editproducts.cgi should only list classifications in which there are products you can administer - Patch by Frédéric Buclin r=ghendricks a=LpSolit --- diff --git a/editproducts.cgi b/editproducts.cgi index eaef243fdc..e1356abbc3 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());