Class ActiveLdap::EntryAttribute
In: lib/active_ldap/entry_attribute.rb
Parent: Object
Error AttributeAssignmentError AdapterNotSpecified OperationNotPermitted RequiredObjectClassMissed ConnectionError RequiredAttributeMissed LdifInvalid LdapError DistinguishedNameNotSetError EntryNotFound SaveError StrongAuthenticationRequired AdapterNotFound TimeoutError AuthenticationError AttributeValueInvalid EntryNotSaved DistinguishedNameInputInvalid EntryAlreadyExist ObjectClassError UnknownAttribute EntryInvalid DeleteError ConfigurationError ConnectionNotSetup DistinguishedNameInvalid Schema\n[lib/active_ldap/schema.rb\nlib/active_ldap/schema/syntaxes.rb] DistinguishedName Base Reloadable::Deprecated Reloadable::Subclasses Enumerable Ldif Collection EntryAttribute StandardError Children HasManyWrap HasMany BelongsToMany Proxy BelongsTo Common Find LDIF Delete Update Normalizable GetText Parser ActiveRecord::Callbacks ActiveRecord::Validations Base\n[lib/active_ldap/adapter/base.rb\nlib/active_ldap/adapter/jndi.rb\nlib/active_ldap/adapter/ldap.rb\nlib/active_ldap/adapter/net_ldap.rb] Jndi Ldap NetLdap GetTextSupport Xml JndiConnection lib/active_ldap/distinguished_name.rb lib/active_ldap/base.rb lib/active_ldap/xml.rb lib/active_ldap/schema.rb lib/active_ldap/entry_attribute.rb lib/active_ldap/ldif.rb lib/active_ldap/ldap_error.rb Compatible ClassMethods Associations LdapBenchmarking ActionController Populate lib/active_ldap/association/has_many_wrap.rb lib/active_ldap/association/children.rb lib/active_ldap/association/collection.rb lib/active_ldap/association/proxy.rb lib/active_ldap/association/belongs_to_many.rb lib/active_ldap/association/belongs_to.rb lib/active_ldap/association/has_many.rb HasManyUtils Association ClassMethods Tree Acts Command Update Common ModifyNameRecordLoadable AddOperationModifiable DeleteOperationModifiable ReplaceOperationModifiable ModifyRecordLoadable DeleteRecordLoadable AddRecordLoadable ContentRecordLoadable LDIF Delete Find Operations GetTextSupport Escape ClassMethods Normalizable Attributes ClassMethods Configuration ClassMethods ObjectClass lib/active_ldap/get_text/parser.rb GetText ClassMethods Callbacks Validations lib/active_ldap/adapter/jndi_connection.rb lib/active_ldap/adapter/net_ldap.rb lib/active_ldap/adapter/ldap.rb lib/active_ldap/adapter/jndi.rb Adapter Helper GetTextFallback ClassMethods HumanReadable Salt UserPassword ClassMethods Connection ActiveLdap dot/m_46_0.png

Methods

all_names   names   new   normalize   register  

Included Modules

Attributes::Normalizable

Attributes

may  [R] 
must  [R] 
object_classes  [R] 
schemata  [R] 

Public Class methods

[Source]

    # File lib/active_ldap/entry_attribute.rb, line 8
 8:     def initialize(schema, object_classes)
 9:       @schemata = {}
10:       @names = {}
11:       @normalized_names = {}
12:       @aliases = {}
13:       @must = []
14:       @may = []
15:       @object_classes = []
16:       register(schema.attribute('objectClass'))
17:       object_classes.each do |objc|
18:         # get all attributes for the class
19:         object_class = schema.object_class(objc)
20:         @object_classes << object_class
21:         @must.concat(object_class.must)
22:         @may.concat(object_class.may)
23:       end
24:       @must.uniq!
25:       @may.uniq!
26:       (@must + @may).each do |attr|
27:         # Update attr_method with appropriate
28:         register(attr)
29:       end
30:     end

Public Instance methods

[Source]

    # File lib/active_ldap/entry_attribute.rb, line 59
59:     def all_names
60:       @names.keys + @aliases.keys
61:     end

[Source]

    # File lib/active_ldap/entry_attribute.rb, line 32
32:     def names(normalize=false)
33:       names = @names.keys
34:       if normalize
35:         names.collect do |name|
36:           normalize(name)
37:         end.uniq
38:       else
39:         names
40:       end
41:     end

[Source]

    # File lib/active_ldap/entry_attribute.rb, line 43
43:     def normalize(name, allow_normalized_name=false)
44:       return name if name.nil?
45:       return nil if @names.empty? and @aliases.empty?
46:       name = name.to_s
47:       real_name = @names[name]
48:       real_name ||= @aliases[name.underscore]
49:       if real_name
50:         real_name
51:       elsif allow_normalized_name
52:         return nil if @normalized_names.empty?
53:         @normalized_names[normalize_attribute_name(name)]
54:       else
55:         nil
56:       end
57:     end

register

Make a method entry for every alias of a valid attribute and map it onto the first attribute passed in.

[Source]

    # File lib/active_ldap/entry_attribute.rb, line 67
67:     def register(attribute)
68:       real_name = attribute.name
69:       return if @schemata.has_key?(real_name)
70:       @schemata[real_name] = attribute
71:       ([real_name] + attribute.aliases).each do |name|
72:         @names[name] = real_name
73:         @aliases[name.underscore] = real_name
74:         @normalized_names[normalize_attribute_name(name)] = real_name
75:       end
76:     end

[Validate]