Skip to content
Snippets Groups Projects

[EE] Add users search results to global search

Merged Jan Provaznik requested to merge ee-users-search-results into master
All threads resolved!
3 files
+ 55
13
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 11
8
@@ -53,15 +53,14 @@ def verify_search_scope!
@@ -53,15 +53,14 @@ def verify_search_scope!
# EE, without having to modify this file directly.
# EE, without having to modify this file directly.
end
end
params :scope do |options|
def check_users_search_allowed!
scope_entities =
if Feature.disabled?(:users_search, default_enabled: true) && params[:scope].to_sym == :users
if Feature.enabled?(:users_search, default_enabled: true)
render_api_error!({ error: _("Scope not supported with disabled 'users_search' feature!") }, 400)
SCOPE_ENTITY
end
else
end
SCOPE_ENTITY.reject { |key, value| key == :users }
end
values = scope_entities.stringify_keys.slice(*options[:values]).keys
params :scope do |options|
 
values = SCOPE_ENTITY.stringify_keys.slice(*options[:values]).keys
requires :scope,
requires :scope,
type: String,
type: String,
@@ -81,6 +80,7 @@ def verify_search_scope!
@@ -81,6 +80,7 @@ def verify_search_scope!
end
end
get do
get do
verify_search_scope!
verify_search_scope!
 
check_users_search_allowed!
present search, with: entity
present search, with: entity
end
end
@@ -98,6 +98,7 @@ def verify_search_scope!
@@ -98,6 +98,7 @@ def verify_search_scope!
end
end
get ':id/(-/)search' do
get ':id/(-/)search' do
verify_search_scope!
verify_search_scope!
 
check_users_search_allowed!
present search(group_id: user_group.id), with: entity
present search(group_id: user_group.id), with: entity
end
end
@@ -114,6 +115,8 @@ def verify_search_scope!
@@ -114,6 +115,8 @@ def verify_search_scope!
use :pagination
use :pagination
end
end
get ':id/(-/)search' do
get ':id/(-/)search' do
 
check_users_search_allowed!
 
present search(project_id: user_project.id), with: entity
present search(project_id: user_project.id), with: entity
end
end
end
end
Loading