From 98f7afb9a163b4481f076d3a8a40b6c5a3d4fa47 Mon Sep 17 00:00:00 2001
From: farhatahmad <35435341+farhatahmad@users.noreply.github.com>
Date: Fri, 28 Jun 2019 16:06:21 -0400
Subject: [PATCH] Fixed issue with user list (#589)

---
 app/controllers/admins_controller.rb | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/app/controllers/admins_controller.rb b/app/controllers/admins_controller.rb
index d7e31e7b..8f87171e 100644
--- a/app/controllers/admins_controller.rb
+++ b/app/controllers/admins_controller.rb
@@ -170,12 +170,14 @@ class AdminsController < ApplicationController
 
   # Gets the list of users based on your configuration
   def user_list
-    list = if @role.present?
-      User.with_role(@role.to_sym).where.not(id: current_user.id)
-    else
+    initial_list = if current_user.has_role? :super_admin
       User.where.not(id: current_user.id)
+    else
+      User.without_role(:super_admin).where.not(id: current_user.id)
     end
 
+    list = @role.present? ? initial_list.with_role(@role.to_sym) : initial_list
+
     if Rails.configuration.loadbalanced_configuration
       list.where(provider: user_settings_provider)
           .admins_search(@search)
-- 
GitLab