| Module | ActiveLdap::Attributes |
| In: |
lib/active_ldap/attributes.rb
|
# File lib/active_ldap/attributes.rb, line 3 3: def self.included(base) 4: base.class_eval do 5: extend(ClassMethods) 6: extend(Normalizable) 7: include(Normalizable) 8: end 9: end
# File lib/active_ldap/attributes.rb, line 172
172: def attributes_protected_by_default
173: begin
174: _dn_attribute = dn_attribute_with_fallback
175: rescue DistinguishedNameInvalid
176: end
177: [_dn_attribute, 'objectClass'].compact
178: end
# File lib/active_ldap/attributes.rb, line 180
180: def normalize_attribute_name(name)
181: self.class.normalize_attribute_name(name)
182: end
# File lib/active_ldap/attributes.rb, line 152
152: def remove_attributes_protected_from_mass_assignment(targets)
153: needless_attributes = {}
154: (attributes_protected_by_default +
155: (self.class.protected_attributes || [])).each do |name|
156: needless_attributes[to_real_attribute_name(name)] = true
157: end
158:
159: _dn_attribute = nil
160: begin
161: _dn_attribute = dn_attribute_with_fallback
162: rescue DistinguishedNameInvalid
163: end
164: targets.collect do |key, value|
165: key = _dn_attribute if ["id", "dn"].include?(key.to_s)
166: [to_real_attribute_name(key) || key, value]
167: end.reject do |key, value|
168: needless_attributes[key]
169: end
170: end