summaryrefslogtreecommitdiffstats
path: root/query.cgi
diff options
context:
space:
mode:
authordave%intrec.com <>2000-11-21 04:42:36 +0100
committerdave%intrec.com <>2000-11-21 04:42:36 +0100
commita1e8485ef53e7dcab07bae5c2ddc9d0c94a97ffb (patch)
treeb74e105f21fe08cf3fb42413ef40314baeb6d0d7 /query.cgi
parentc39e36be239e6d16868f73a533808101d5e6ab2f (diff)
downloadbugzilla-a1e8485ef53e7dcab07bae5c2ddc9d0c94a97ffb.tar.gz
bugzilla-a1e8485ef53e7dcab07bae5c2ddc9d0c94a97ffb.tar.xz
Fix for bug 45586: Component, Version, and Milestone values are no longer
shown that belong to products the user can't see if usebuggroups is active. Patch by Matthias Radestock <rade@lshift.net>
Diffstat (limited to 'query.cgi')
-rwxr-xr-xquery.cgi62
1 files changed, 47 insertions, 15 deletions
diff --git a/query.cgi b/query.cgi
index 23bbf58cc..ea96e37ee 100755
--- a/query.cgi
+++ b/query.cgi
@@ -20,6 +20,7 @@
#
# Contributor(s): Terry Weissman <terry@mozilla.org>
# David Gardiner <david.gardiner@unisa.edu.au>
+# Matthias Radestock <matthias@sorted.org>
use diagnostics;
use strict;
@@ -278,16 +279,47 @@ my $emailinput2 = GenerateEmailInput(2);
# have access to. remove them from the list.
@::product_list = ();
+my %component_set;
+my %version_set;
+my %milestone_set;
foreach my $p (@::legal_product) {
- if(Param("usebuggroupsentry")
- && GroupExists($p)
- && !UserInGroup($p)) {
- # If we're using bug groups to restrict entry on products, and
- # this product has a bug group, and the user is not in that
- # group, we don't want to include that product in this list.
- next;
- }
- push @::product_list, $p;
+ if(Param("usebuggroups")
+ && GroupExists($p)
+ && !UserInGroup($p)) {
+ # If we're using bug groups to restrict entry on products, and
+ # this product has a bug group, and the user is not in that
+ # group, we don't want to include that product in this list.
+ next;
+ }
+ push @::product_list, $p;
+ foreach my $c (@{$::components{$p}}) {
+ $component_set{$c} = 1;
+ }
+ foreach my $v (@{$::versions{$p}}) {
+ $version_set{$v} = 1;
+ }
+ foreach my $m (@{$::target_milestone{$p}}) {
+ $milestone_set{$m} = 1;
+ }
+}
+
+@::component_list = ();
+@::version_list = ();
+@::milestone_list = ();
+foreach my $c (@::legal_components) {
+ if ($component_set{$c}) {
+ push @::component_list, $c;
+ }
+}
+foreach my $v (@::legal_versions) {
+ if ($version_set{$v}) {
+ push @::version_list, $v;
+ }
+}
+foreach my $m (@::legal_target_milestone) {
+ if ($milestone_set{$m}) {
+ push @::milestone_list, $m;
+ }
}
# javascript
@@ -308,16 +340,16 @@ my $m;
my $i = 0;
my $j = 0;
-foreach $c (@::legal_components) {
+foreach $c (@::component_list) {
$jscript .= "cpts['$c'] = new Array();\n";
}
-foreach $v (@::legal_versions) {
+foreach $v (@::version_list) {
$jscript .= "vers['$v'] = new Array();\n";
}
my $tm;
-foreach $tm (@::legal_target_milestone) {
+foreach $tm (@::milestone_list) {
$jscript .= "tms['$tm'] = new Array();\n";
}
@@ -629,13 +661,13 @@ print "
<td align=left valign=top>
<SELECT NAME=\"version\" MULTIPLE SIZE=5>
-@{[make_options(\@::legal_versions, $default{'version'}, $type{'version'})]}
+@{[make_options(\@::version_list, $default{'version'}, $type{'version'})]}
</SELECT>
</td>
<td align=left valign=top>
<SELECT NAME=\"component\" MULTIPLE SIZE=5>
-@{[make_options(\@::legal_components, $default{'component'}, $type{'component'})]}
+@{[make_options(\@::component_list, $default{'component'}, $type{'component'})]}
</SELECT>
</td>";
@@ -643,7 +675,7 @@ if (Param("usetargetmilestone")) {
print "
<td align=left valign=top>
<SELECT NAME=\"target_milestone\" MULTIPLE SIZE=5>
-@{[make_options(\@::legal_target_milestone, $default{'target_milestone'}, $type{'target_milestone'})]}
+@{[make_options(\@::milestone_list, $default{'target_milestone'}, $type{'target_milestone'})]}
</SELECT>
</td>";
}