Class: AD::Framework::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/ad-framework/config.rb,
lib/ad-framework/config/mapping.rb,
lib/ad-framework/config/attribute_definition.rb

Defined Under Namespace

Classes: AttributeDefinition, Mapping

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



12
13
14
15
16
17
18
19
# File 'lib/ad-framework/config.rb', line 12

def initialize
  self.mappings = AD::Framework::Config::Mapping.new
  self.mappings.add(:dn, "distinguishedname")

  self.attributes = AD::Framework::Config::Mapping.new
  self.attribute_types = AD::Framework::Config::Mapping.new
  self.object_classes = AD::Framework::Config::Mapping.new
end

Instance Attribute Details

#attribute_typesObject

Returns the value of attribute attribute_types.



10
11
12
# File 'lib/ad-framework/config.rb', line 10

def attribute_types
  @attribute_types
end

#attributesObject

Returns the value of attribute attributes.



10
11
12
# File 'lib/ad-framework/config.rb', line 10

def attributes
  @attributes
end

#ldap_prefixObject

Returns the value of attribute ldap_prefix.



10
11
12
# File 'lib/ad-framework/config.rb', line 10

def ldap_prefix
  @ldap_prefix
end

#object_classesObject

Returns the value of attribute object_classes.



10
11
12
# File 'lib/ad-framework/config.rb', line 10

def object_classes
  @object_classes
end

Instance Method Details

#add_attribute(attribute) ⇒ Object



57
58
59
60
61
# File 'lib/ad-framework/config.rb', line 57

def add_attribute(attribute)
  definition = AD::Framework::Config::AttributeDefinition.new(attribute)
  self.mappings.add(definition.name, definition.ldap_name)
  self.attributes.add(definition.name, definition)
end

#add_attribute_type(attribute_type) ⇒ Object



62
63
64
# File 'lib/ad-framework/config.rb', line 62

def add_attribute_type(attribute_type)
  self.attribute_types.add(attribute_type.key, attribute_type)
end

#add_object_class(object_class) ⇒ Object



65
66
67
# File 'lib/ad-framework/config.rb', line 65

def add_object_class(object_class)
  self.object_classes.add(object_class.ldap_name, object_class)
end

#ldap(&block) ⇒ Object Also known as: adapter



29
30
31
32
33
34
# File 'lib/ad-framework/config.rb', line 29

def ldap(&block)
  if block
    AD::LDAP.configure(&block)
  end
  AD::LDAP
end

#loggerObject



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

def logger
  self.adapter.logger
end

#logger=(new_logger) ⇒ Object



40
41
42
# File 'lib/ad-framework/config.rb', line 40

def logger=(new_logger)
  self.adapter.config.logger = new_logger
end