Switch admin users index from pure LDAP to database

This commit is contained in:
Râu Cao
2023-02-25 15:31:19 +08:00
parent 678e80a25d
commit 8eb487600c
2 changed files with 11 additions and 11 deletions

View File

@@ -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