Class: Oxford::LDAPAdapter
- Inherits:
-
Object
- Object
- Oxford::LDAPAdapter
- Defined in:
- lib/oxford/ldap.rb
Instance Method Summary collapse
- #connected? ⇒ Boolean
-
#initialize ⇒ LDAPAdapter
constructor
A new instance of LDAPAdapter.
- #load_config ⇒ Object
- #setup_connection ⇒ Object
Constructor Details
#initialize ⇒ LDAPAdapter
Returns a new instance of LDAPAdapter.
3 4 5 6 |
# File 'lib/oxford/ldap.rb', line 3 def initialize load_config setup_connection end |
Instance Method Details
#connected? ⇒ Boolean
24 25 26 27 28 29 30 31 |
# File 'lib/oxford/ldap.rb', line 24 def connected? begin ActiveLdap::Base.search(:base => @base, :filter => '(cn=admin)', :scope => :sub) return true rescue => e return false end end |
#load_config ⇒ Object
8 9 10 11 |
# File 'lib/oxford/ldap.rb', line 8 def load_config config = YAML.load_file(Oxford::Runner.config) config['ldap'].each { |key, value| instance_variable_set "@#{key}", value } end |
#setup_connection ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/oxford/ldap.rb', line 13 def setup_connection ActiveLdap::Base.setup_connection( :host => @host, :port => @port, :base => @base, :method => @method, :bind_dn => @user, :password => @pass ) end |