Module: ActiveLdap::Configuration::ClassMethods

### Home Classes Methods

### In Files

- lib/active_ldap/configuration.rb

### Methods

- #configuration
- #default_configuration
- #define_configuration
- #defined_configurations
- #ensure_configuration
- #merge_configuration
- #prepare_configuration
- #remove_configuration_by_configuration
- #remove_connection_related_configuration

### 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::Configuration::ClassMethods

### Constants

CONNECTION_CONFIGURATION_KEYS

### Public Instance Methods

configuration(key=nil) click to toggle source

    # File lib/active_ldap/configuration.rb, line 79
    def configuration(key=nil)
      @@defined_configurations[key || active_connection_name]
    end

default_configuration() click to toggle source

    # File lib/active_ldap/configuration.rb, line 52
    def default_configuration
      DEFAULT_CONFIG.dup
    end

define_configuration(key, config) click to toggle source

    # File lib/active_ldap/configuration.rb, line 83
    def define_configuration(key, config)
      @@defined_configurations[key] = config
    end

defined_configurations() click to toggle source

    # File lib/active_ldap/configuration.rb, line 87
    def defined_configurations
      @@defined_configurations
    end

ensure_configuration(config=nil) click to toggle source

    # File lib/active_ldap/configuration.rb, line 56
    def ensure_configuration(config=nil)
      if config.nil?
        if defined?(LDAP_ENV)
          config = LDAP_ENV
        elsif defined?(Rails)
          config = Rails.env
        else
          config = {}
        end
      end

      if config.is_a?(Symbol) or config.is_a?(String)
        _config = configurations[config.to_s]
        unless _config
          raise ConnectionError,
                _("%s connection is not configured") % config
        end
        config = _config
      end

      config
    end

merge_configuration(user_configuration, target=self) click to toggle source

    # File lib/active_ldap/configuration.rb, line 102
    def merge_configuration(user_configuration, target=self)
      configuration = default_configuration
      prepare_configuration(user_configuration).each do |key, value|
        case key
        when :base
          # Scrub before inserting
          target.base = value.gsub(/['}{#]/, '')
        when :scope, :ldap_scope
          if key == :ldap_scope
            message = _(":ldap_scope configuration option is deprecated. "                            "Use :scope instead.")
            ActiveSupport::Deprecation.warn(message)
          end
          target.scope = value
          configuration[:scope] = value
        else
          configuration[key] = value
        end
      end
      configuration
    end

prepare_configuration(configuration) click to toggle source

    # File lib/active_ldap/configuration.rb, line 124
    def prepare_configuration(configuration)
      configuration = configuration.symbolize_keys
      uri = configuration.delete(:uri)
      return configuration unless uri

      begin
        uri = URI.parse(uri)
      rescue URI::InvalidURIError
        raise ConfigurationError.new(_("invalid URI: %s") % uri)
      end
      unless uri.is_a?(URI::LDAP)
        raise ConfigurationError.new(_("not a LDAP URI: %s") % uri.to_s)
      end

      uri_configuration = {:port => uri.port}
      uri_configuration[:host] = uri.host if uri.host
      uri_configuration[:bind_dn] = uri.dn if uri.dn
      uri_configuration[:scope] = uri.scope if uri.scope
      uri_configuration[:method] = :ssl if uri.is_a?(URI::LDAPS)
      uri_configuration.merge(configuration)
    end

remove_configuration_by_configuration(config) click to toggle source

    # File lib/active_ldap/configuration.rb, line 91
    def remove_configuration_by_configuration(config)
      @@defined_configurations.delete_if {|key, value| value == config}
    end

remove_connection_related_configuration(config) click to toggle source

    # File lib/active_ldap/configuration.rb, line 96
    def remove_connection_related_configuration(config)
      config.reject do |key, value|
        CONNECTION_CONFIGURATION_KEYS.include?(key)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.