diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-03-16 08:19:02 +0100 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2019-03-16 08:19:02 +0100 |
commit | a68c1cdc38ffe8d4fe21c1bf562c8456c354da7f (patch) | |
tree | 40626328888ffa46d3495f2f9dc219d1ee006e88 /lib/api/search.rb | |
parent | b53376592491cf2016fe68fecaf5f090cf4627b4 (diff) | |
parent | 27ac48c394780df923eeb94f3a7f47f6a5f4c649 (diff) | |
download | gitlab-ce-users-search-results.tar.gz |
Merge branch 'siemens/gitlab-ce-feature/users-search-results' into users-search-resultsusers-search-results
Diffstat (limited to 'lib/api/search.rb')
-rw-r--r-- | lib/api/search.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/api/search.rb b/lib/api/search.rb index f65e810bf90..60095300ea1 100644 --- a/lib/api/search.rb +++ b/lib/api/search.rb @@ -17,7 +17,8 @@ module API blobs: Entities::Blob, wiki_blobs: Entities::Blob, snippet_titles: Entities::Snippet, - snippet_blobs: Entities::Snippet + snippet_blobs: Entities::Snippet, + users: Entities::UserBasic }.freeze def search(additional_params = {}) @@ -51,6 +52,12 @@ module API # Defining this method here as a noop allows us to easily extend it in # EE, without having to modify this file directly. end + + def check_users_search_allowed! + if params[:scope].to_sym == :users && Feature.disabled?(:users_search, default_enabled: true) + render_api_error!({ error: _("Scope not supported with disabled 'users_search' feature!") }, 400) + end + end end resource :search do @@ -67,6 +74,7 @@ module API end get do verify_search_scope! + check_users_search_allowed! present search, with: entity end @@ -87,6 +95,7 @@ module API end get ':id/(-/)search' do verify_search_scope! + check_users_search_allowed! present search(group_id: user_group.id), with: entity end @@ -106,6 +115,8 @@ module API use :pagination end get ':id/(-/)search' do + check_users_search_allowed! + present search(project_id: user_project.id), with: entity end end |