diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index fbe0252..f408ac7 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -3,10 +3,11 @@ class Admin::UsersController < Admin::BaseController before_action :set_current_section def index - ldap = LdapService.new - @ou = params[:ou] || "kosmos.org" - @orgs = ldap.fetch_organizations - @entries = ldap.fetch_users(ou: @ou) + ldap = LdapService.new + @ou = params[:ou] || "kosmos.org" + @orgs = ldap.fetch_organizations + @users = User.where(ou: @ou).order(cn: :asc).to_a + @stats = { users_confirmed: User.where(ou: @ou).confirmed.count, users_pending: User.where(ou: @ou).pending.count diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb index 8bc4db3..9e60ac7 100644 --- a/app/views/admin/users/index.html.erb +++ b/app/views/admin/users/index.html.erb @@ -34,18 +34,17 @@ UID - E-Mail - Admin + Status + Roles - <% @entries.each do |entry| %> + <% @users.each do |user| %> - <%= entry[:uid] %> - <%= entry[:mail] %> - <%= entry[:admin] %> - + <%= link_to(user.cn, admin_user_path(user.address), class: 'ks-text-link') %> + <%= user.confirmed_at.nil? ? badge("pending", :yellow) : "" %> + <%= user.is_admin? ? badge("admin", :red) : "" %> <% end %>