Class: Adhearsion::LDAP::Plugin::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/adhearsion/ldap/plugin/service.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.startObject



7
8
9
# File 'lib/adhearsion/ldap/plugin/service.rb', line 7

def start
  new.start
end

Instance Method Details

#startObject

Start LDAP connection



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/adhearsion/ldap/plugin/service.rb', line 14

def start
  raise "Must supply a host argument to the LDAP configuration" if (config.host.nil? || config.host.empty?)
  raise "Must supply a valid port to the LDAP configuration" unless config.port.is_a? Integer

  require_models
  establish_connection  config.host,
                        config.port,
                        config.base,
                        config.bind_dn,
                        config.password,
                        config.allow_anonymous,
                        config.try_sasl

  Events.register_callback(:shutdown) { stop }
end

#stopObject

Release LDAP connection



40
41
42
# File 'lib/adhearsion/ldap/plugin/service.rb', line 40

def stop
  ActiveLdap::Base.remove_connection
end