class ActiveLdap::Adapter::Ldap

Public Instance Methods

add(dn, entries, options={}) click to toggle source
# File lib/active_ldap/adapter/ldap.rb, line 125
def add(dn, entries, options={})
  super do |_dn, _entries|
    controls = options[:controls]
    attributes = parse_entries(_entries)
    info = {:dn => _dn, :attributes => _entries}
    if controls
      info.merge!(:name => :add, :controls => controls)
      execute(:add_ext, info, _dn, attributes, controls, [])
    else
      execute(:add, info, _dn, attributes)
    end
  end
end
bind(options={}) click to toggle source
# File lib/active_ldap/adapter/ldap.rb, line 69
def bind(options={})
  super do
    @connection.error_message
  end
end
bind_as_anonymous(options={}) click to toggle source
# File lib/active_ldap/adapter/ldap.rb, line 75
def bind_as_anonymous(options={})
  super do
    execute(:bind, :name => "bind: anonymous")
    true
  end
end
connect(options={}) click to toggle source
# File lib/active_ldap/adapter/ldap.rb, line 53
def connect(options={})
  super do |host, port, method|
    uri = construct_uri(host, port, method.ssl?)
    with_start_tls = method.start_tls?
    info = {:uri => uri, :with_start_tls => with_start_tls}
    [log("connect", info) {method.connect(host, port)},
     uri, with_start_tls]
  end
end
delete(targets, options={}) click to toggle source
# File lib/active_ldap/adapter/ldap.rb, line 111
def delete(targets, options={})
  super do |target|
    controls = options[:controls]
    info = {:dn => target}
    if controls
      info.merge!(:name => :delete, :controls => controls)
      execute(:delete_ext, info,
              target, controls, [])
    else
      execute(:delete, info, target)
    end
  end
end
modify(dn, entries, options={}) click to toggle source
# File lib/active_ldap/adapter/ldap.rb, line 139
def modify(dn, entries, options={})
  super do |_dn, _entries|
    controls = options[:controls]
    attributes = parse_entries(_entries)
    info = {:dn => _dn, :attributes => _entries}
    if controls
      info.merge!(:name => :modify, :controls => controls)
      execute(:modify_ext, info, _dn, attributes, controls, [])
    else
      execute(:modify, info, _dn, attributes)
    end
  end
end
modify_rdn(dn, new_rdn, delete_old_rdn, new_superior, options={}) click to toggle source
# File lib/active_ldap/adapter/ldap.rb, line 153
def modify_rdn(dn, new_rdn, delete_old_rdn, new_superior, options={})
  super do |_dn, _new_rdn, _delete_old_rdn, _new_superior|
    if _new_superior
      raise NotImplemented.new(_("modify RDN with new superior"))
    end
    info = {
      :name => "modify: RDN",
      :dn => _dn,
      :new_rdn => _new_rdn,
      :new_superior => _new_superior,
      :delete_old_rdn => _delete_old_rdn
    }
    execute(:modrdn, info, _dn, _new_rdn, _delete_old_rdn)
  end
end
unbind(options={}) click to toggle source
# File lib/active_ldap/adapter/ldap.rb, line 63
def unbind(options={})
  super do
    execute(:unbind)
  end
end