Class: Chaltron::LdapController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/chaltron/ldap_controller.rb

Instance Method Summary collapse

Instance Method Details

#multi_createObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/chaltron/ldap_controller.rb', line 25

def multi_create
  @created = []
  @error   = []
  (params[:uids] || []).each do |uid|
    user = Chaltron::LDAP::Person.find_by_uid(uid).create_user(params[:user][:roles])
    if user.new_record?
      @error << user
    else
      @created << user
    end
  end
  info I18n.t('chaltron.logs.users.ldap_created',
      current: current_user.display_name, count: @created.size,
      user: @created.map(&:display_name).join(', ')) if @created.size > 0
end

#multi_newObject



13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/chaltron/ldap_controller.rb', line 13

def multi_new
  @entries = []
  userid = params[:userid]
  if userid.present?
    entry = Chaltron::LDAP::Person.find_by_uid(userid)
    @entries << entry
  else
    @entries = Chaltron::LDAP::Person.find_by_fields(find_options)
  end
  @entries.compact!
end

#searchObject



9
10
11
# File 'app/controllers/chaltron/ldap_controller.rb', line 9

def search
  @limit = default_limit
end