summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Search.pm
diff options
context:
space:
mode:
authorSimon Green <sgreen@redhat.com>2013-12-18 11:47:13 +0100
committerSimon Green <sgreen@redhat.com>2013-12-18 11:47:13 +0100
commit9e7ad08c56aacbe889b614ee2394b58b108c9ca2 (patch)
treeab3fd04b3e7330ca8996a29e3d28c1374370b46b /Bugzilla/Search.pm
parent8465c056a7c2cac1d6905e8b476f200b934f11b0 (diff)
downloadbugzilla-9e7ad08c56aacbe889b614ee2394b58b108c9ca2.tar.gz
bugzilla-9e7ad08c56aacbe889b614ee2394b58b108c9ca2.tar.xz
Bug 452525 - Allow the option of "OR" groups ("any of the groups" instead of "all of the groups")
r=gerv, a=sgreen
Diffstat (limited to 'Bugzilla/Search.pm')
-rw-r--r--Bugzilla/Search.pm20
1 files changed, 15 insertions, 5 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index e89a9b361..e546be6d9 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -1228,9 +1228,12 @@ sub _standard_joins {
push(@joins, $security_join);
if ($user->id) {
- $security_join->{extra} =
- ["NOT (" . $user->groups_in_sql('security_map.group_id') . ")"];
-
+ # See also _standard_joins for the other half of the below statement
+ if (!Bugzilla->params->{'or_groups'}) {
+ $security_join->{extra} =
+ ["NOT (" . $user->groups_in_sql('security_map.group_id') . ")"];
+ }
+
my $security_cc_join = {
table => 'cc',
as => 'security_cc',
@@ -1304,10 +1307,17 @@ sub _standard_where {
# until their group controls are set. So if a bug has a NULL creation_ts,
# it shouldn't show up in searches at all.
my @where = ('bugs.creation_ts IS NOT NULL');
-
- my $security_term = 'security_map.group_id IS NULL';
my $user = $self->_user;
+ my $security_term = '';
+ # See also _standard_joins for the other half of the below statement
+ if (Bugzilla->params->{'or_groups'}) {
+ $security_term .= " (security_map.group_id IS NULL OR security_map.group_id IN (" . $user->groups_as_string . "))";
+ }
+ else {
+ $security_term = 'security_map.group_id IS NULL';
+ }
+
if ($user->id) {
my $userid = $user->id;
# This indentation makes the resulting SQL more readable.