diff --git a/doc/development/advanced_search.md b/doc/development/advanced_search.md index 718b65e867f6f6ad4aaf4da94cd9fea20f1c91c7..98c6d436a59a1902ce11f43c231f889ba920be91 100644 --- a/doc/development/advanced_search.md +++ b/doc/development/advanced_search.md @@ -487,7 +487,7 @@ Requires `current_user` and `group_ids` fields. Query based on the permissions t } ``` -##### `by_confidentiality` +##### `by_project_confidentiality` Requires `confidential`, `author_id`, `assignee_id`, `project_id` fields. Query with `confidential` in options. diff --git a/ee/lib/search/elastic/filters.rb b/ee/lib/search/elastic/filters.rb index a4c5c82bc649788343f040547f3cf1b5ec5128ae..6200607e86613b58b32450de4d1672d3cc3b73ba 100644 --- a/ee/lib/search/elastic/filters.rb +++ b/ee/lib/search/elastic/filters.rb @@ -307,7 +307,7 @@ def by_group_level_authorization(query_hash:, options:) end end - def by_confidentiality(query_hash:, options:) + def by_project_confidentiality(query_hash:, options:) confidential = options[:confidential] user = options[:current_user] project_ids = options[:project_ids] @@ -381,7 +381,7 @@ def by_confidentiality(query_hash:, options:) end # deprecated - use by_search_level_and_membership - def by_authorization(query_hash:, options:) + def by_project_authorization(query_hash:, options:) user = options[:current_user] project_ids = options[:project_ids] group_ids = options[:group_ids] diff --git a/ee/lib/search/elastic/issue_query_builder.rb b/ee/lib/search/elastic/issue_query_builder.rb index 4e5fd8be02aed2baf56e14f9111c47f042eb6a03..bff69972444e0bf9c056044b37443061d9ec9184 100644 --- a/ee/lib/search/elastic/issue_query_builder.rb +++ b/ee/lib/search/elastic/issue_query_builder.rb @@ -24,8 +24,8 @@ def build end end - query_hash = ::Search::Elastic::Filters.by_authorization(query_hash: query_hash, options: options) - query_hash = ::Search::Elastic::Filters.by_confidentiality(query_hash: query_hash, options: options) + query_hash = ::Search::Elastic::Filters.by_project_authorization(query_hash: query_hash, options: options) + query_hash = ::Search::Elastic::Filters.by_project_confidentiality(query_hash: query_hash, options: options) query_hash = ::Search::Elastic::Filters.by_state(query_hash: query_hash, options: options) query_hash = ::Search::Elastic::Filters.by_not_hidden(query_hash: query_hash, options: options) query_hash = ::Search::Elastic::Filters.by_label_ids(query_hash: query_hash, options: options) diff --git a/ee/lib/search/elastic/merge_request_query_builder.rb b/ee/lib/search/elastic/merge_request_query_builder.rb index 14f8381b557070dc5750a0531bbe948b96f6a4b1..19b40d1239d48d593477edfa36d134ae0564e385 100644 --- a/ee/lib/search/elastic/merge_request_query_builder.rb +++ b/ee/lib/search/elastic/merge_request_query_builder.rb @@ -9,7 +9,7 @@ class MergeRequestQueryBuilder < QueryBuilder def build query_hash = build_query_hash(query: query, options: options) - query_hash = ::Search::Elastic::Filters.by_authorization(query_hash: query_hash, options: options) + query_hash = ::Search::Elastic::Filters.by_project_authorization(query_hash: query_hash, options: options) query_hash = ::Search::Elastic::Filters.by_state(query_hash: query_hash, options: options) query_hash = ::Search::Elastic::Filters.by_archived(query_hash: query_hash, options: options) diff --git a/ee/lib/search/elastic/milestone_query_builder.rb b/ee/lib/search/elastic/milestone_query_builder.rb index 5deef6faf3c77494b2edccfc11e38ff17d652b00..f0594c39060d1e3c089cd50d2b2d620e5c627f6d 100644 --- a/ee/lib/search/elastic/milestone_query_builder.rb +++ b/ee/lib/search/elastic/milestone_query_builder.rb @@ -17,7 +17,7 @@ def build end query_hash = ::Search::Elastic::Filters.by_type(query_hash: query_hash, options: options) - query_hash = ::Search::Elastic::Filters.by_authorization(query_hash: query_hash, options: options) + query_hash = ::Search::Elastic::Filters.by_project_authorization(query_hash: query_hash, options: options) query_hash = ::Search::Elastic::Filters.by_archived(query_hash: query_hash, options: options) query_hash = ::Search::Elastic::Formats.source_fields(query_hash: query_hash, options: options) ::Search::Elastic::Formats.size(query_hash: query_hash, options: options) diff --git a/ee/lib/search/elastic/work_item_query_builder.rb b/ee/lib/search/elastic/work_item_query_builder.rb index 55a709cfeaac7d4a6c88353f050cb7660abf5087..debb366a0d982a7493f017d0cd726711a9283bfd 100644 --- a/ee/lib/search/elastic/work_item_query_builder.rb +++ b/ee/lib/search/elastic/work_item_query_builder.rb @@ -27,14 +27,14 @@ def build query_hash = if options[:group_level_authorization] ::Search::Elastic::Filters.by_group_level_authorization(query_hash: query_hash, options: options) else - ::Search::Elastic::Filters.by_authorization(query_hash: query_hash, options: options) + ::Search::Elastic::Filters.by_project_authorization(query_hash: query_hash, options: options) end query_hash = if options[:group_level_confidentiality] ::Search::Elastic::Filters.by_group_level_confidentiality(query_hash: query_hash, options: options) else - ::Search::Elastic::Filters.by_confidentiality(query_hash: query_hash, options: options) + ::Search::Elastic::Filters.by_project_confidentiality(query_hash: query_hash, options: options) end query_hash = ::Search::Elastic::Filters.by_state(query_hash: query_hash, options: options) diff --git a/ee/spec/lib/search/elastic/filters_spec.rb b/ee/spec/lib/search/elastic/filters_spec.rb index eb686deb7034b0cc232d8f1cb177113978e7b470..91568bf6b73e226e71e952946a6e53c90f7bf6b4 100644 --- a/ee/spec/lib/search/elastic/filters_spec.rb +++ b/ee/spec/lib/search/elastic/filters_spec.rb @@ -943,11 +943,13 @@ end end - describe '.by_confidentiality' do + describe '.by_project_confidentiality' do let_it_be(:authorized_project) { create(:project, developers: [user]) } let_it_be(:private_project) { create(:project, :private) } - subject(:by_confidentiality) { described_class.by_confidentiality(query_hash: query_hash, options: options) } + subject(:by_project_confidentiality) do + described_class.by_project_confidentiality(query_hash: query_hash, options: options) + end context 'when options[:confidential] is not passed or not true/false' do let(:base_options) { { current_user: user } } @@ -990,10 +992,10 @@ ] } } ] - expect(by_confidentiality.dig(:query, :bool, :filter)).to match(expected_filter) - expect(by_confidentiality.dig(:query, :bool, :must)).to be_empty - expect(by_confidentiality.dig(:query, :bool, :must_not)).to be_empty - expect(by_confidentiality.dig(:query, :bool, :should)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :filter)).to match(expected_filter) + expect(by_project_confidentiality.dig(:query, :bool, :must)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :should)).to be_empty end end @@ -1003,10 +1005,10 @@ it 'adds the non-confidential filters to query_hash' do expected_filter = [{ term: { confidential: { _name: 'filters:non_confidential', value: false } } }] - expect(by_confidentiality.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_confidentiality.dig(:query, :bool, :must)).to be_empty - expect(by_confidentiality.dig(:query, :bool, :must_not)).to be_empty - expect(by_confidentiality.dig(:query, :bool, :should)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_confidentiality.dig(:query, :bool, :must)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :should)).to be_empty end end end @@ -1023,10 +1025,10 @@ it 'adds the requested confidential filter to the query hash' do expected_filter = [{ term: { confidential: true } }] - expect(by_confidentiality.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_confidentiality.dig(:query, :bool, :must)).to be_empty - expect(by_confidentiality.dig(:query, :bool, :must_not)).to be_empty - expect(by_confidentiality.dig(:query, :bool, :should)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_confidentiality.dig(:query, :bool, :must)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :should)).to be_empty end end @@ -1036,10 +1038,10 @@ it 'adds the requested confidential filter to the query hash' do expected_filter = [{ term: { confidential: true } }] - expect(by_confidentiality.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_confidentiality.dig(:query, :bool, :must)).to be_empty - expect(by_confidentiality.dig(:query, :bool, :must_not)).to be_empty - expect(by_confidentiality.dig(:query, :bool, :should)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_confidentiality.dig(:query, :bool, :must)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :should)).to be_empty end end @@ -1067,10 +1069,10 @@ ] } } ] - expect(by_confidentiality.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_confidentiality.dig(:query, :bool, :must)).to be_empty - expect(by_confidentiality.dig(:query, :bool, :must_not)).to be_empty - expect(by_confidentiality.dig(:query, :bool, :should)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_confidentiality.dig(:query, :bool, :must)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :should)).to be_empty end end @@ -1080,16 +1082,16 @@ it 'adds the non-confidential filters to query_hash' do expected_filter = [{ term: { confidential: { _name: 'filters:non_confidential', value: false } } }] - expect(by_confidentiality.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_confidentiality.dig(:query, :bool, :must)).to be_empty - expect(by_confidentiality.dig(:query, :bool, :must_not)).to be_empty - expect(by_confidentiality.dig(:query, :bool, :should)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_confidentiality.dig(:query, :bool, :must)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_confidentiality.dig(:query, :bool, :should)).to be_empty end end end end - describe '.by_authorization' do + describe '.by_project_authorization' do let_it_be_with_reload(:public_group) { create(:group, :public) } let_it_be_with_reload(:authorized_project) { create(:project, group: public_group, developers: [user]) } let_it_be_with_reload(:private_project) { create(:project, :private, group: public_group) } @@ -1114,8 +1116,8 @@ } end - subject(:by_authorization) do - described_class.by_authorization(query_hash: query_hash, options: options) + subject(:by_project_authorization) do + described_class.by_project_authorization(query_hash: query_hash, options: options) end # anonymous users @@ -1143,10 +1145,10 @@ } } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when no_join_project is true' do @@ -1169,10 +1171,10 @@ } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end end @@ -1205,10 +1207,10 @@ ] } } } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when no_join_project is true' do @@ -1243,10 +1245,10 @@ } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when project_id_field is set in options' do @@ -1281,10 +1283,10 @@ } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end end @@ -1316,10 +1318,10 @@ ] } } } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when no_join_project is true' do @@ -1342,10 +1344,10 @@ } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end end @@ -1365,10 +1367,10 @@ ] } } } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end @@ -1384,10 +1386,10 @@ ] } } } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end end @@ -1428,10 +1430,10 @@ ] } } } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when no_join_project is true' do @@ -1480,10 +1482,10 @@ } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end @@ -1527,10 +1529,10 @@ } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when project_id_field is set in options' do @@ -1576,10 +1578,10 @@ } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end end @@ -1608,10 +1610,10 @@ ] } }] } } } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when no_join_project is true' do @@ -1630,10 +1632,10 @@ ] } }] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when project_id_field is set in options' do @@ -1652,10 +1654,10 @@ ] } }] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end end @@ -1700,10 +1702,10 @@ ] } } } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when no_join_project is true' do @@ -1744,10 +1746,10 @@ ] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when project_id_field is set in options' do @@ -1788,10 +1790,10 @@ ] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end end @@ -1826,10 +1828,10 @@ } ] - expect(by_authorization.dig(:query, :bool, :filter)).to match(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to match(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when no_join_project is true' do @@ -1854,10 +1856,10 @@ } ] - expect(by_authorization.dig(:query, :bool, :filter)).to match(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to match(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when project_id_field is set in options' do @@ -1880,10 +1882,10 @@ ] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to match(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to match(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end end @@ -1933,10 +1935,10 @@ ] } } } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to match(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to match(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when no_join_project is true' do @@ -1982,10 +1984,10 @@ ] } }] - expect(by_authorization.dig(:query, :bool, :filter)).to match(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to match(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'and project_id_field is provided in options' do @@ -2031,10 +2033,10 @@ ] } }] - expect(by_authorization.dig(:query, :bool, :filter)).to match(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to match(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end end @@ -2066,10 +2068,10 @@ { terms: { _name: 'filters:reject_projects', project_id: [private_project.id] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when traversal_ids_prefix is set in options' do @@ -2093,10 +2095,10 @@ { terms: { _name: 'filters:reject_projects', project_id: [private_project.id] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end @@ -2125,10 +2127,10 @@ } ] - expect(by_authorization.dig(:query, :bool, :filter)).to match(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to match(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end @@ -2150,10 +2152,10 @@ { terms: { _name: 'filters:reject_projects', project_id: [private_project.id] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when authorization_use_traversal_ids is false in options' do @@ -2176,10 +2178,10 @@ } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to match(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to match(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end @@ -2204,10 +2206,10 @@ { terms: { _name: 'filters:reject_projects', project_id: [private_project.id] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end @@ -2232,10 +2234,10 @@ { terms: { _name: 'filters:reject_projects', foo: [private_project.id] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end end @@ -2262,10 +2264,10 @@ { terms: { _name: 'filters:reject_projects', project_id: [private_project.id] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when no_join_project is true' do @@ -2286,10 +2288,10 @@ { terms: { _name: 'filters:reject_projects', project_id: [private_project.id] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when project_id_field is set in options' do @@ -2310,10 +2312,10 @@ { terms: { _name: 'filters:reject_projects', foo: [private_project.id] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to eq(expected_must_not) + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end end @@ -2352,10 +2354,10 @@ } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when no_join_project is true' do @@ -2376,10 +2378,10 @@ ] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when project_id_field is set in options' do @@ -2403,10 +2405,10 @@ ] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end end @@ -2456,10 +2458,10 @@ ] } } } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when no_join_project is true' do @@ -2500,10 +2502,10 @@ ] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end context 'when project_id_field is set in options' do @@ -2544,10 +2546,10 @@ ] } } ] - expect(by_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) - expect(by_authorization.dig(:query, :bool, :must)).to be_empty - expect(by_authorization.dig(:query, :bool, :must_not)).to be_empty - expect(by_authorization.dig(:query, :bool, :should)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :filter)).to eq(expected_filter) + expect(by_project_authorization.dig(:query, :bool, :must)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :must_not)).to be_empty + expect(by_project_authorization.dig(:query, :bool, :should)).to be_empty end end end