Skip to content
Snippets Groups Projects
Unverified Commit cf3b4507 authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

Only return required info for dynamic user lists (#2397)

parent 85b8cac9
Branches
No related tags found
No related merge requests found
...@@ -80,6 +80,8 @@ gem 'cancancan', '~> 2.0' ...@@ -80,6 +80,8 @@ gem 'cancancan', '~> 2.0'
gem 'aws-sdk-s3', '~> 1.75' gem 'aws-sdk-s3', '~> 1.75'
gem 'google-cloud-storage', '~> 1.26' gem 'google-cloud-storage', '~> 1.26'
gem 'pluck_to_hash', '~> 1.0.2'
group :production do group :production do
# Use a postgres database in production. # Use a postgres database in production.
gem 'pg', '~> 0.18' gem 'pg', '~> 0.18'
......
...@@ -256,6 +256,9 @@ GEM ...@@ -256,6 +256,9 @@ GEM
parser (2.7.1.3) parser (2.7.1.3)
ast (~> 2.4.0) ast (~> 2.4.0)
pg (0.21.0) pg (0.21.0)
pluck_to_hash (1.0.2)
activerecord (>= 4.0.2)
activesupport (>= 4.0.2)
popper_js (1.16.0) popper_js (1.16.0)
public_suffix (4.0.5) public_suffix (4.0.5)
puma (3.12.6) puma (3.12.6)
...@@ -443,6 +446,7 @@ DEPENDENCIES ...@@ -443,6 +446,7 @@ DEPENDENCIES
omniauth-twitter omniauth-twitter
pagy pagy
pg (~> 0.18) pg (~> 0.18)
pluck_to_hash (~> 1.0.2)
puma (~> 3.12) puma (~> 3.12)
rails (~> 5.2.4.4) rails (~> 5.2.4.4)
rails-controller-testing rails-controller-testing
......
...@@ -199,10 +199,10 @@ class AdminsController < ApplicationController ...@@ -199,10 +199,10 @@ class AdminsController < ApplicationController
# GET /admins/merge_list # GET /admins/merge_list
def merge_list def merge_list
# Returns a list of users that can merged into another user # Returns a list of users that can merged into another user
initial_list = User.select(:uid, :name, :email) initial_list = User.without_role(:super_admin)
.without_role(:super_admin)
.where.not(uid: current_user.uid) .where.not(uid: current_user.uid)
.merge_list_search(params[:search]) .merge_list_search(params[:search])
.pluck_to_hash(:uid, :name, :email)
initial_list = initial_list.where(provider: @user_domain) if Rails.configuration.loadbalanced_configuration initial_list = initial_list.where(provider: @user_domain) if Rails.configuration.loadbalanced_configuration
......
...@@ -209,10 +209,10 @@ class UsersController < ApplicationController ...@@ -209,10 +209,10 @@ class UsersController < ApplicationController
roles_can_appear << role.name if role.get_permission("can_appear_in_share_list") && role.priority >= 0 roles_can_appear << role.name if role.get_permission("can_appear_in_share_list") && role.priority >= 0
end end
initial_list = User.select(:uid, :name) initial_list = User.where.not(uid: current_user.uid)
.where.not(uid: current_user.uid)
.with_role(roles_can_appear) .with_role(roles_can_appear)
.shared_list_search(params[:search]) .shared_list_search(params[:search])
.pluck_to_hash(:uid, :name)
initial_list = initial_list.where(provider: @user_domain) if Rails.configuration.loadbalanced_configuration initial_list = initial_list.where(provider: @user_domain) if Rails.configuration.loadbalanced_configuration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment