Class ActiveLdap::Association::HasManyWrap
In: lib/active_ldap/association/has_many_wrap.rb
Parent: Collection
Error AttributeAssignmentError AdapterNotSpecified OperationNotPermitted RequiredObjectClassMissed ConnectionError RequiredAttributeMissed LdifInvalid DistinguishedNameNotSetError EntryNotFound LdapError SaveError StrongAuthenticationRequired AdapterNotFound ConnectionNotEstablished TimeoutError AuthenticationError AttributeValueInvalid EntryNotSaved DistinguishedNameInputInvalid EntryAlreadyExist ObjectClassError UnknownAttribute EntryInvalid DeleteError ConfigurationError DistinguishedNameInvalid Base DistinguishedName Reloadable::Deprecated Reloadable::Subclasses Enumerable Ldif Collection EntryAttribute StandardError Children HasMany HasManyWrap 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 Schema\n[lib/active_ldap/schema.rb\nlib/active_ldap/schema/syntaxes.rb] JndiConnection lib/active_ldap/distinguished_name.rb lib/active_ldap/base.rb lib/active_ldap/schema.rb lib/active_ldap/entry_attribute.rb lib/active_ldap/ldif.rb lib/active_ldap/ldap_error.rb ClassMethods Associations LdapBenchmarking ActionController ClassMethods Tree Acts 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 Command Update Common ModifyNameRecordLoadable AddOperationModifiable DeleteOperationModifiable ReplaceOperationModifiable ModifyRecordLoadable DeleteRecordLoadable AddRecordLoadable ContentRecordLoadable LDIF Delete Find Operations ClassMethods Normalizable Attributes GetTextSupport Escape 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/base.rb lib/active_ldap/adapter/jndi.rb Adapter Helper GetTextFallback ClassMethods HumanReadable ClassMethods Connection Salt UserPassword ActiveLdap dot/m_44_0.png

Methods

Included Modules

HasManyUtils

Private Instance methods

[Source]

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

[Source]

    # File lib/active_ldap/association/has_many_wrap.rb, line 37
37:       def find_target
38:         targets, requested_targets = collect_targets(:wrap, true)
39:         return [] if targets.nil?
40: 
41:         found_targets = {}
42:         foreign_base_key = primary_key
43:         targets.each do |target|
44:           found_targets[target[foreign_base_key]] ||= target
45:         end
46: 
47:         klass = foreign_class
48:         requested_targets.collect do |name|
49:           found_targets[name] || klass.new(name)
50:         end
51:       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:         _primary_key = primary_key
13:         if _primary_key == "dn"
14:           old_value = dn_values_to_string_values(old_value)
15:         end
16:         new_value = (old_value + entry[_primary_key, true]).uniq.sort
17:         if old_value != new_value
18:           @owner[@options[:wrap]] = new_value
19:           @owner.save
20:         end
21:       end

[Validate]