From 9e7ad08c56aacbe889b614ee2394b58b108c9ca2 Mon Sep 17 00:00:00 2001 From: Simon Green Date: Wed, 18 Dec 2013 20:47:13 +1000 Subject: Bug 452525 - Allow the option of "OR" groups ("any of the groups" instead of "all of the groups") r=gerv, a=sgreen --- request.cgi | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'request.cgi') diff --git a/request.cgi b/request.cgi index 118935092..b771cee37 100755 --- a/request.cgi +++ b/request.cgi @@ -118,20 +118,27 @@ sub queue { ON bugs.product_id = products.id INNER JOIN components ON bugs.component_id = components.id - LEFT JOIN bug_group_map AS bgmap - ON bgmap.bug_id = bugs.bug_id - AND bgmap.group_id NOT IN (" . - $user->groups_as_string . ") LEFT JOIN bug_group_map AS privs ON privs.bug_id = bugs.bug_id LEFT JOIN cc AS ccmap ON ccmap.who = $userid AND ccmap.bug_id = bugs.bug_id - " . + LEFT JOIN bug_group_map AS bgmap + ON bgmap.bug_id = bugs.bug_id + "; + + if (Bugzilla->params->{or_groups}) { + $query .= " AND bgmap.group_id IN (" . $user->groups_as_string . ")"; + $query .= " WHERE (privs.group_id IS NULL OR bgmap.group_id IS NOT NULL OR"; + } + else { + $query .= " AND bgmap.group_id NOT IN (" . $user->groups_as_string . ")"; + $query .= " WHERE (bgmap.group_id IS NULL OR"; + } # Weed out bug the user does not have access to - " WHERE ((bgmap.group_id IS NULL) OR - (ccmap.who IS NOT NULL AND cclist_accessible = 1) OR + $query .= + " (ccmap.who IS NOT NULL AND cclist_accessible = 1) OR (bugs.reporter = $userid AND bugs.reporter_accessible = 1) OR (bugs.assigned_to = $userid) " . (Bugzilla->params->{'useqacontact'} ? "OR -- cgit v1.2.3-65-gdbad