Commit fc45b0f3 authored by Terri Chu's avatar Terri Chu Committed by Heinrich Lee Yu

Remove issue project joins for group/project scoped searches

parent 1da63054
...@@ -33,6 +33,29 @@ module Elastic ...@@ -33,6 +33,29 @@ module Elastic
private private
# Builds an elasticsearch query that will select documents from a
# set of projects for Group and Project searches, taking user access
# rules for issues into account. Relies upon super for Global searches
def project_ids_filter(query_hash, options)
return super if options[:public_and_internal_projects]
current_user = options[:current_user]
scoped_project_ids = scoped_project_ids(current_user, options[:project_ids])
return super if scoped_project_ids == :any
context.name(:project) do
query_hash[:query][:bool][:filter] ||= []
query_hash[:query][:bool][:filter] << {
terms: {
_name: context.name,
project_id: filter_ids_by_feature(scoped_project_ids, current_user, 'issues')
}
}
end
query_hash
end
def confidentiality_filter(query_hash, options) def confidentiality_filter(query_hash, options)
current_user = options[:current_user] current_user = options[:current_user]
project_ids = options[:project_ids] project_ids = options[:project_ids]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment