forked from External/greenlight
GRN2-310: Share Access now dynamically pulls the list of users from the server (#2380)
* Share Access now dynamically pulls the list of users from the server * Merge users now dynamically pulls the list of users from the server * Only return the information needed to the front-end
This commit is contained in:
@ -40,11 +40,10 @@ class AdminsController < ApplicationController
|
||||
@tab = params[:tab] || "active"
|
||||
@role = params[:role] ? Role.find_by(name: params[:role], provider: @user_domain) : nil
|
||||
|
||||
if @tab == "invited"
|
||||
users = invited_users_list
|
||||
users = if @tab == "invited"
|
||||
invited_users_list
|
||||
else
|
||||
users = manage_users_list
|
||||
@user_list = merge_user_list
|
||||
manage_users_list
|
||||
end
|
||||
|
||||
@pagy, @users = pagy(users)
|
||||
@ -86,8 +85,6 @@ class AdminsController < ApplicationController
|
||||
@participants_count[meet[:meetingID]] = meet[:participantCount]
|
||||
end
|
||||
|
||||
@user_list = shared_user_list if shared_access_allowed
|
||||
|
||||
@pagy, @rooms = pagy_array(server_rooms_list)
|
||||
end
|
||||
|
||||
@ -199,6 +196,22 @@ class AdminsController < ApplicationController
|
||||
redirect_back fallback_location: admins_path
|
||||
end
|
||||
|
||||
# GET /admins/merge_list
|
||||
def merge_list
|
||||
# Returns a list of users that can merged into another user
|
||||
initial_list = User.select(:uid, :name, :email)
|
||||
.without_role(:super_admin)
|
||||
.where.not(uid: current_user.uid)
|
||||
.merge_list_search(params[:search])
|
||||
|
||||
initial_list = initial_list.where(provider: @user_domain) if Rails.configuration.loadbalanced_configuration
|
||||
|
||||
# Respond with JSON object of users
|
||||
respond_to do |format|
|
||||
format.json { render body: initial_list.to_json }
|
||||
end
|
||||
end
|
||||
|
||||
# SITE SETTINGS
|
||||
|
||||
# POST /admins/update_settings
|
||||
|
@ -65,27 +65,6 @@ module Populator
|
||||
end
|
||||
end
|
||||
|
||||
# Returns a list of users that are in the same context of the current user
|
||||
def shared_user_list
|
||||
roles_can_appear = []
|
||||
Role.where(provider: @user_domain).each do |role|
|
||||
roles_can_appear << role.name if role.get_permission("can_appear_in_share_list") && role.priority >= 0
|
||||
end
|
||||
|
||||
initial_list = User.where.not(uid: current_user.uid).with_role(roles_can_appear)
|
||||
|
||||
return initial_list unless Rails.configuration.loadbalanced_configuration
|
||||
initial_list.where(provider: @user_domain)
|
||||
end
|
||||
|
||||
# Returns a list of users that can merged into another user
|
||||
def merge_user_list
|
||||
initial_list = User.without_role(:super_admin).where.not(uid: current_user.uid)
|
||||
|
||||
return initial_list unless Rails.configuration.loadbalanced_configuration
|
||||
initial_list.where(provider: @user_domain)
|
||||
end
|
||||
|
||||
# Returns a list off all current invitations
|
||||
def invited_users_list
|
||||
list = if Rails.configuration.loadbalanced_configuration
|
||||
|
@ -79,8 +79,6 @@ class RoomsController < ApplicationController
|
||||
@search, @order_column, @order_direction, recs =
|
||||
recordings(@room.bbb_id, params.permit(:search, :column, :direction), true)
|
||||
|
||||
@user_list = shared_user_list if shared_access_allowed
|
||||
|
||||
@pagy, @recordings = pagy_array(recs)
|
||||
else
|
||||
return redirect_to root_path, flash: { alert: I18n.t("room.invalid_provider") } if incorrect_user_domain
|
||||
|
@ -197,6 +197,29 @@ class UsersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# GET /shared_access_list
|
||||
def shared_access_list
|
||||
# Don't allow searchs unless atleast 3 characters are passed
|
||||
return redirect_to '/404' if params[:search].length < 3
|
||||
|
||||
roles_can_appear = []
|
||||
Role.where(provider: @user_domain).each do |role|
|
||||
roles_can_appear << role.name if role.get_permission("can_appear_in_share_list") && role.priority >= 0
|
||||
end
|
||||
|
||||
initial_list = User.select(:uid, :name)
|
||||
.where.not(uid: current_user.uid)
|
||||
.with_role(roles_can_appear)
|
||||
.shared_list_search(params[:search])
|
||||
|
||||
initial_list = initial_list.where(provider: @user_domain) if Rails.configuration.loadbalanced_configuration
|
||||
|
||||
# Respond with JSON object of users
|
||||
respond_to do |format|
|
||||
format.json { render body: initial_list.to_json }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_user
|
||||
|
Reference in New Issue
Block a user