Class: AD::LDAP::Adapter

Inherits:
Net::LDAP
  • Object
show all
Defined in:
lib/ad-ldap/adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Adapter

Returns a new instance of Adapter.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ad-ldap/adapter.rb', line 11

def initialize(config)
  self.config = config
  super({
    :host => self.config.host,
    :port => self.config.port,
    :base => self.config.treebase,
    :encryption => self.config.encryption
  })
  if self.config.auth
    self.auth(self.config.auth[:username], self.config.auth[:password])
  end
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



9
10
11
# File 'lib/ad-ldap/adapter.rb', line 9

def config
  @config
end

Instance Method Details

#delete_attribute(dn, attribute) ⇒ Object



47
48
49
50
51
# File 'lib/ad-ldap/adapter.rb', line 47

def delete_attribute(dn, attribute)
  result = super
  self.check_operation
  result
end

#openObject

don’t raise when an open connection is already open, just yield it



25
26
27
28
29
30
31
# File 'lib/ad-ldap/adapter.rb', line 25

def open
  if @open_connection
    yield @open_connection
  else
    super
  end
end

#search(args = {}) ⇒ Object



53
54
55
56
57
# File 'lib/ad-ldap/adapter.rb', line 53

def search(args = {})
  results = super(args.dup)
  self.check_operation
  results
end