Module: AD::LDAP

Defined in:
lib/ad-ldap.rb,
lib/ad-ldap/logger.rb,
lib/ad-ldap/adapter.rb,
lib/ad-ldap/version.rb,
lib/ad-ldap/response.rb,
lib/ad-ldap/exceptions.rb,
lib/ad-ldap/search_args.rb

Defined Under Namespace

Classes: Adapter, Error, Logger, Response, SearchArgs

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.adapterObject



25
26
27
# File 'lib/ad-ldap.rb', line 25

def adapter
  @adapter ||= AD::LDAP::Adapter.new(self.config)
end

.add(args = {}) ⇒ Object



33
34
35
# File 'lib/ad-ldap.rb', line 33

def add(args = {})
  self.run(:add, args)
end

.bind_as(args = {}) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/ad-ldap.rb', line 53

def bind_as(args = {})
  if !args[:filter]
    password = args.delete(:password)
    search_args = AD::LDAP::SearchArgs.new(args)
    args = {
      :filter => search_args[:filter],
      :password => password
    }
  end
  !!self.run(:bind_as, args)
end

.configObject



17
18
19
20
21
22
23
# File 'lib/ad-ldap.rb', line 17

def config
  @config ||= OpenStruct.new({
    :run_commands => false,
    :search_size_supported => true,
    :mappings => {}
  })
end

.configure {|self.config| ... } ⇒ Object

Yields:



13
14
15
# File 'lib/ad-ldap.rb', line 13

def configure
  yield self.config
end

.delete(dn) ⇒ Object



37
38
39
# File 'lib/ad-ldap.rb', line 37

def delete(dn)
  self.run(:delete, { :dn => dn })
end

.delete_attribute(dn, field) ⇒ Object



45
46
47
# File 'lib/ad-ldap.rb', line 45

def delete_attribute(dn, field)
  self.run(:delete_attribute, dn, field)
end

.loggerObject



29
30
31
# File 'lib/ad-ldap.rb', line 29

def logger
  @logger ||= AD::LDAP::Logger.new(self.config)
end

.replace_attribute(dn, field, value) ⇒ Object



41
42
43
# File 'lib/ad-ldap.rb', line 41

def replace_attribute(dn, field, value)
  self.run(:replace_attribute, dn, field, value)
end

.search(args = {}) ⇒ Object



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

def search(args = {})
  self.run_search(args)
end