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:
@ -37,7 +37,7 @@ class Ability
|
||||
|
||||
if highest_role.get_permission("can_manage_users")
|
||||
can [:index, :edit_user, :promote, :demote, :ban_user, :unban_user,
|
||||
:approve, :invite, :reset, :undelete, :merge_user], :admin
|
||||
:approve, :invite, :reset, :undelete, :merge_user, :merge_list], :admin
|
||||
end
|
||||
|
||||
can [:server_recordings, :server_rooms], :admin if highest_role.get_permission("can_manage_rooms_recordings")
|
||||
|
@ -95,6 +95,24 @@ class User < ApplicationRecord
|
||||
order(Arel.sql("users.#{column} #{direction}"))
|
||||
end
|
||||
|
||||
def self.shared_list_search(string)
|
||||
return all if string.blank?
|
||||
|
||||
search_query = "users.name LIKE :search OR users.uid LIKE :search"
|
||||
|
||||
search_param = "%#{sanitize_sql_like(string)}%"
|
||||
where(search_query, search: search_param)
|
||||
end
|
||||
|
||||
def self.merge_list_search(string)
|
||||
return all if string.blank?
|
||||
|
||||
search_query = "users.name LIKE :search OR users.email LIKE :search"
|
||||
|
||||
search_param = "%#{sanitize_sql_like(string)}%"
|
||||
where(search_query, search: search_param)
|
||||
end
|
||||
|
||||
# Returns a list of rooms ordered by last session (with nil rooms last)
|
||||
def ordered_rooms
|
||||
return [] if main_room.nil?
|
||||
|
Reference in New Issue
Block a user