Module: ActiveLdap::Helper

### Home Classes Methods

### In Files

- lib/active_ldap/helper.rb

### Methods

- #la_
- #lad_
- #ldap_attribute_description_gettext
- #ldap_attribute_name_gettext
- #ldap_field
- #ldap_object_class_description_gettext
- #ldap_object_class_name_gettext
- #ldap_syntax_description_gettext
- #ldap_syntax_name_gettext
- #loc_
- #locd_
- #ls_
- #lsd_

### 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::Helper

### Public Instance Methods

la_(attribute) click to toggle source
Alias for: ldap_attribute_name_gettext
lad_(attribute) click to toggle source
Alias for: ldap_attribute_description_gettext
ldap_attribute_description_gettext(attribute) click to toggle source

    # File lib/active_ldap/helper.rb, line 8
    def ldap_attribute_description_gettext(attribute)
      Base.human_attribute_description(attribute)
    end

Also aliased as: lad_
ldap_attribute_name_gettext(attribute) click to toggle source

    # File lib/active_ldap/helper.rb, line 3
    def ldap_attribute_name_gettext(attribute)
      Base.human_attribute_name(attribute)
    end

Also aliased as: la_
ldap_field(type, object_name, method, options={}) click to toggle source

    # File lib/active_ldap/helper.rb, line 33
    def ldap_field(type, object_name, method, options={})
      case type
      when "radio_button", "check_box", "text_area"
        form_method = type
      else
        form_method = "#{type}_field"
      end

      object = options[:object]
      if object.nil?
        normalized_object_name = object_name.to_s.sub(/\[\](\])?$/, "\\1")
        object = instance_variable_get("@#{normalized_object_name}")
      end
      values = object.nil? ? nil : object[method, true]
      values = [nil] if values.blank?
      required_ldap_options = options.delete(:ldap_options) || []
      required_ldap_options.each do |required_ldap_option|
        found = false
        values.each do |value|
          next unless value.is_a?(Hash)
          if Hash.to_a[0].to_s == required_ldap_option.to_s
            found = true
            break
          end
        end
        values << {required_ldap_option => ""} unless found
      end

      fields = []
      collect_values = Proc.new do |value, ldap_options|
        case value
        when Hash
          value.each do |k, v|
            collect_values.call(v, ldap_options + [k])
          end
        when Array
          value.each do |v|
            collect_values.call(v, ldap_options)
          end
        else
          id = "#{object_name}_#{method}"
          name = "#{object_name}[#{method}][]"
          ldap_options.collect.each do |ldap_option|
            id << "_#{ldap_option}"
            name << "[#{ldap_option}][]"
          end
          ldap_value_options = {:id => id, :name => name, :value => value}
          field = send(form_method, object_name, method,
                       ldap_value_options.merge(options))
           if block_given?
             field = yield(field, {:options => ldap_options, :value => value})
           end
          fields << field unless field.blank?
        end
      end
      collect_values.call(values, [])
      fields.join("\n")
    end

ldap_object_class_description_gettext(object_class) click to toggle source

    # File lib/active_ldap/helper.rb, line 18
    def ldap_object_class_description_gettext(object_class)
      Base.human_object_class_description(object_class)
    end

Also aliased as: locd_
ldap_object_class_name_gettext(object_class) click to toggle source

    # File lib/active_ldap/helper.rb, line 13
    def ldap_object_class_name_gettext(object_class)
      Base.human_object_class_name(object_class)
    end

Also aliased as: loc_
ldap_syntax_description_gettext(syntax) click to toggle source

    # File lib/active_ldap/helper.rb, line 28
    def ldap_syntax_description_gettext(syntax)
      Base.human_syntax_description(syntax)
    end

Also aliased as: lsd_
ldap_syntax_name_gettext(syntax) click to toggle source

    # File lib/active_ldap/helper.rb, line 23
    def ldap_syntax_name_gettext(syntax)
      Base.human_syntax_name(syntax)
    end

Also aliased as: ls_
loc_(object_class) click to toggle source
Alias for: ldap_object_class_name_gettext
locd_(object_class) click to toggle source
Alias for: ldap_object_class_description_gettext
ls_(syntax) click to toggle source
Alias for: ldap_syntax_name_gettext
lsd_(syntax) click to toggle source
Alias for: ldap_syntax_description_gettext

[Validate]

Generated with the Darkfish Rdoc Generator 2.