Class: ActiveLdap::Adapter::NetLdap

### Home Classes Methods

### In Files

- lib/active_ldap/adapter/net_ldap.rb

### Parent

ActiveLdap::Adapter::Base

### Methods

- #add
- #bind
- #bind_as_anonymous
- #connect
- #delete
- #modify
- #modify_rdn
- #search
- #unbind

### Files

- USAGE

### Class/Module Index

Quicksearch

- ActiveLdap
- ActiveLdap::ActionController
- ActiveLdap::ActionController::LdapBenchmarking
- ActiveLdap::Acts
- ActiveLdap::Acts::Tree
- ActiveLdap::Acts::Tree::ClassMethods
- ActiveLdap::Adapter
- ActiveLdap::Adapter::Base
- ActiveLdap::Adapter::Jndi
- ActiveLdap::Adapter::JndiConnection
- ActiveLdap::Adapter::JndiConnection::ModifyRecord
- ActiveLdap::Adapter::JndiConnection::Scope
- ActiveLdap::Adapter::Ldap
- ActiveLdap::Adapter::Ldap::Method
- ActiveLdap::Adapter::Ldap::Method::Base
- ActiveLdap::Adapter::Ldap::Method::Plain
- ActiveLdap::Adapter::Ldap::Method::SSL
- ActiveLdap::Adapter::Ldap::Method::TLS
- ActiveLdap::Adapter::NetLdap
- ActiveLdap::Association
- ActiveLdap::Association::BelongsTo
- ActiveLdap::Association::BelongsToMany
- ActiveLdap::Association::Children
- ActiveLdap::Association::Collection
- ActiveLdap::Association::HasMany
- ActiveLdap::Association::HasManyUtils
- ActiveLdap::Association::HasManyWrap
- ActiveLdap::Association::Proxy
- ActiveLdap::Associations
- ActiveLdap::Associations::ClassMethods
- ActiveLdap::AttributeMethods
- ActiveLdap::AttributeMethods::BeforeTypeCast
- ActiveLdap::AttributeMethods::Dirty
- ActiveLdap::AttributeMethods::Query
- ActiveLdap::AttributeMethods::Read
- ActiveLdap::AttributeMethods::Write
- ActiveLdap::Attributes
- ActiveLdap::Attributes::ClassMethods
- ActiveLdap::Attributes::Normalizable
- ActiveLdap::Callbacks
- ActiveLdap::Callbacks::ClassMethods
- ActiveLdap::Command
- ActiveLdap::Compatible
- ActiveLdap::Configuration
- ActiveLdap::Configuration::ClassMethods
- ActiveLdap::Connection
- ActiveLdap::Connection::ClassMethods
- ActiveLdap::DN
- ActiveLdap::DistinguishedName
- ActiveLdap::DistinguishedName::Parser
- ActiveLdap::EntryAttribute
- ActiveLdap::Escape
- ActiveLdap::Generators
- ActiveLdap::Generators::ModelGenerator
- ActiveLdap::Generators::ScaffoldGenerator
- ActiveLdap::GetText
- ActiveLdap::GetText::Parser
- ActiveLdap::GetTextSupport
- ActiveLdap::Helper
- ActiveLdap::HumanReadable
- ActiveLdap::HumanReadable::ClassMethods
- ActiveLdap::LDIF
- ActiveLdap::LdapError
- ActiveLdap::Ldif
- ActiveLdap::Ldif::AddRecord
- ActiveLdap::Ldif::Attribute
- ActiveLdap::Ldif::Attributes
- ActiveLdap::Ldif::ChangeRecord
- ActiveLdap::Ldif::ChangeRecord::Control
- ActiveLdap::Ldif::ContentRecord
- ActiveLdap::Ldif::DeleteRecord
- ActiveLdap::Ldif::ModifyDNRecord
- ActiveLdap::Ldif::ModifyNameRecord
- ActiveLdap::Ldif::ModifyRDNRecord
- ActiveLdap::Ldif::ModifyRecord
- ActiveLdap::Ldif::ModifyRecord::AddOperation
- ActiveLdap::Ldif::ModifyRecord::DeleteOperation
- ActiveLdap::Ldif::ModifyRecord::Operation
- ActiveLdap::Ldif::ModifyRecord::ReplaceOperation
- ActiveLdap::Ldif::Parser
- ActiveLdap::Ldif::Record
- ActiveLdap::Ldif::Scanner
- ActiveLdap::LogSubscriber
- ActiveLdap::ObjectClass
- ActiveLdap::ObjectClass::ClassMethods
- ActiveLdap::Operations
- ActiveLdap::Operations::ClassOnlyDelete
- ActiveLdap::Operations::ClassOnlyUpdate
- ActiveLdap::Operations::Common
- ActiveLdap::Operations::Delete
- ActiveLdap::Operations::Find
- ActiveLdap::Operations::LDIF
- ActiveLdap::Operations::LDIF::AddRecordLoadable
- ActiveLdap::Operations::LDIF::ContentRecordLoadable
- ActiveLdap::Operations::LDIF::DeleteRecordLoadable
- ActiveLdap::Operations::LDIF::ModifyNameRecordLoadable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable::AddOperationModifiable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable::DeleteOperationModifiable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable::ReplaceOperationModifiable
- ActiveLdap::Operations::Update
- ActiveLdap::Persistence
- ActiveLdap::Populate
- ActiveLdap::Railtie
- ActiveLdap::Railties
- ActiveLdap::Railties::ControllerRuntime
- ActiveLdap::Railties::ControllerRuntime::ClassMethods
- ActiveLdap::Schema
- ActiveLdap::Schema::Attribute
- ActiveLdap::Schema::Entry
- ActiveLdap::Schema::ObjectClass
- ActiveLdap::Schema::Syntax
- ActiveLdap::Schema::Syntaxes
- ActiveLdap::Schema::Syntaxes::Base
- ActiveLdap::Schema::Syntaxes::BitString
- ActiveLdap::Schema::Syntaxes::Boolean
- ActiveLdap::Schema::Syntaxes::CountryString
- ActiveLdap::Schema::Syntaxes::DirectoryString
- ActiveLdap::Schema::Syntaxes::DistinguishedName
- ActiveLdap::Schema::Syntaxes::GeneralizedTime
- ActiveLdap::Schema::Syntaxes::Integer
- ActiveLdap::Schema::Syntaxes::JPEG
- ActiveLdap::Schema::Syntaxes::NameAndOptionalUID
- ActiveLdap::Schema::Syntaxes::NumericString
- ActiveLdap::Schema::Syntaxes::OID
- ActiveLdap::Schema::Syntaxes::OtherMailbox
- ActiveLdap::Schema::Syntaxes::PostalAddress
- ActiveLdap::Schema::Syntaxes::PrintableString
- ActiveLdap::Schema::Syntaxes::TelephoneNumber
- ActiveLdap::UserPassword
- ActiveLdap::UserPassword::Salt
- ActiveLdap::Validations
- ActiveLdap::XML
- ActiveLdap::Xml
- ActiveLdap::Xml::Serializer
- LDAP
- LDAP::Conn
- LDAP::Mod
- Net
- Net::LDAP
- Net::LDAP::Entry
- ActionView
- ActionView::Base
- URI
- URI::LDAPS
- Object
- Timeout

No matching classes.

# ActiveLdap::Adapter::NetLdap

### Constants

CHARS
METHOD

### Public Instance Methods

add(dn, entries, options={}) click to toggle source

    # File lib/active_ldap/adapter/net_ldap.rb, line 97
    def add(dn, entries, options={})
      super do |_dn, _entries|
        attributes = {}
        _entries.each do |type, key, attrs|
          attrs.each do |name, values|
            attributes[name] = values
          end
        end
        args = {:dn => _dn, :attributes => attributes}
        info = args.dup
        execute(:add, info, args)
      end
    end

bind(options={}) click to toggle source

    # File lib/active_ldap/adapter/net_ldap.rb, line 50
    def bind(options={})
      begin
        super
      rescue Net::LDAP::LdapError
        raise AuthenticationError, $!.message
      end
    end

bind_as_anonymous(options={}) click to toggle source

    # File lib/active_ldap/adapter/net_ldap.rb, line 58
    def bind_as_anonymous(options={})
      super do
        execute(:bind, {:name => "bind: anonymous"}, {:method => :anonymous})
        true
      end
    end

connect(options={}) click to toggle source

    # File lib/active_ldap/adapter/net_ldap.rb, line 23
    def connect(options={})
      super do |host, port, method|
        config = {
          :host => host,
          :port => port,
        }
        config[:encryption] = {:method => method} if method
        begin
          uri = construct_uri(host, port, method == :simple_tls)
          with_start_tls = method == :start_tls
          info = {:uri => uri, :with_start_tls => with_start_tls}
          [log("connect", info) {Net::LDAP::Connection.new(config)},
           uri, with_start_tls]
        rescue Net::LDAP::LdapError
          raise ConnectionError, $!.message
        end
      end
    end

delete(targets, options={}) click to toggle source

    # File lib/active_ldap/adapter/net_ldap.rb, line 89
    def delete(targets, options={})
      super do |target|
        args = {:dn => target}
        info = args.dup
        execute(:delete, info, args)
      end
    end

modify(dn, entries, options={}) click to toggle source

    # File lib/active_ldap/adapter/net_ldap.rb, line 111
    def modify(dn, entries, options={})
      super do |_dn, _entries|
        info = {:dn => _dn, :attributes => _entries}
        execute(:modify, info,
                :dn => _dn,
                :operations => parse_entries(_entries))
      end
    end

modify_rdn(dn, new_rdn, delete_old_rdn, new_superior, options={}) click to toggle source

    # File lib/active_ldap/adapter/net_ldap.rb, line 120
    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(:rename, info,
                :olddn => _dn,
                :newrdn => _new_rdn,
                :delete_attributes => _delete_old_rdn)
      end
    end

search(options={}) click to toggle source

    # File lib/active_ldap/adapter/net_ldap.rb, line 65
    def search(options={})
      super(options) do |base, scope, filter, attrs, limit|
        args = {
          :base => base,
          :scope => scope,
          :filter => filter,
          :attributes => attrs,
          :size => limit,
        }
        info = {
          :base => base, :scope => scope_name(scope),
          :filter => filter, :attributes => attrs, :limit => limit
        }
        execute(:search, info, args) do |entry|
          attributes = {}
          entry.original_attribute_names.each do |name|
            value = entry[name]
            attributes[name] = value if value
          end
          yield([entry.dn, attributes])
        end
      end
    end

unbind(options={}) click to toggle source

    # File lib/active_ldap/adapter/net_ldap.rb, line 42
    def unbind(options={})
      super do
        log("unbind") do
          @connection.close # Net::LDAP doesn't implement unbind.
        end
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.