Class ActiveLdap::Association::HasManyWrap
In: lib/active_ldap/association/has_many_wrap.rb
Parent: Collection
Error AttributeAssignmentError AdapterNotSpecified OperationNotPermitted RequiredObjectClassMissed ConnectionError RequiredAttributeMissed LdifInvalid LdapError DistinguishedNameNotSetError EntryNotFound SaveError StrongAuthenticationRequired NotImplemented 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 GetText::Translation 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/schema/syntaxes.rb lib/active_ldap/xml.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 Translation GetTextFallback ClassMethods HumanReadable Salt UserPassword ClassMethods Connection ActiveLdap dot/m_46_0.png

Methods

Included Modules

HasManyUtils

Private Instance methods

[Source]

    # File lib/active_ldap/association/has_many_wrap.rb, line 25
25:       def delete_entries(entries)
26:         old_value = @owner[@options[:wrap], true]
27:         _foreign_key = foreign_key
28:         if _foreign_key == "dn"
29:           old_value = dn_values_to_string_values(old_value)
30:         end
31:         current_value = entries.collect {|entry| entry[_foreign_key]}
32:         current_value = dn_values_to_string_values(current_value)
33:         new_value = old_value - current_value
34:         new_value = new_value.uniq.sort
35:         if old_value != new_value
36:           @owner[@options[:wrap]] = new_value
37:           @owner.save
38:         end
39:       end

[Source]

    # File lib/active_ldap/association/has_many_wrap.rb, line 41
41:       def find_target
42:         targets, requested_targets = collect_targets(@options[:wrap], true)
43:         return [] if targets.nil?
44: 
45:         found_targets = {}
46:         _foreign_key = foreign_key
47:         targets.each do |target|
48:           found_targets[target[_foreign_key]] ||= target
49:         end
50: 
51:         klass = foreign_class
52:         requested_targets.collect do |name|
53:           found_targets[name] || klass.new(name)
54:         end
55:       end

[Source]

    # File lib/active_ldap/association/has_many_wrap.rb, line 57
57:       def foreign_key
58:         @options[:primary_key_name] || foreign_class.dn_attribute
59:       end

[Source]

    # File lib/active_ldap/association/has_many_wrap.rb, line 10
10:       def insert_entry(entry)
11:         old_value = @owner[@options[:wrap], true]
12:         _foreign_key = foreign_key
13:         if _foreign_key == "dn"
14:           old_value = dn_values_to_string_values(old_value)
15:         end
16:         current_value = entry[_foreign_key, true]
17:         current_value = dn_values_to_string_values(current_value)
18:         new_value = (old_value + current_value).uniq.sort
19:         if old_value != new_value
20:           @owner[@options[:wrap]] = new_value
21:           @owner.save
22:         end
23:       end

[Validate]