Revision 428fdd46
Added by Marc Dequènes almost 15 years ago
- ID 428fdd46a8f2ab849d47b17123cf6413d6cbfacc
lib/ldap_shadows/elements/object.rb | ||
---|---|---|
def self.cast
|
||
super
|
||
|
||
ldap_mapping self.parameters[:mapping]
|
||
ldap_mapping self.parameters[:mapping].reject {|key, val| self.default_parameters[:mapping].keys.include?(key)}
|
||
end
|
||
|
||
def self.cast_relations
|
||
... | ... | |
end
|
||
|
||
def relations
|
||
rel_list = self.class.parameters[:presentation][:associated_relations]
|
||
rel_list = self.class.parameters[:mapping][:associated_relations]
|
||
|
||
aspects.values.each do |aspect|
|
||
rel_list += aspect.parameters[:presentation][:associated_relations]
|
||
rel_list += aspect.parameters[:mapping][:associated_relations]
|
||
end
|
||
|
||
rel_list & possible_relations
|
||
end
|
||
|
||
def self.possible_aspects
|
||
self.parameters[:presentation][:allowed_aspects].sort
|
||
self.parameters[:mapping][:possible_aspects].sort
|
||
end
|
||
|
||
def aspects
|
||
... | ... | |
self.aspects.values.each do |aspect|
|
||
aspect_data = aspect.parameters
|
||
|
||
unless aspect_data[:presentation][:associated_attributes].empty?
|
||
taken_attr_list = aspect_data[:presentation][:associated_attributes] & (attr_list + ignored_attrs)
|
||
unless aspect_data[:mapping][:associated_attributes].empty?
|
||
taken_attr_list = aspect_data[:mapping][:associated_attributes] & (attr_list + ignored_attrs)
|
||
unless taken_attr_list.empty?
|
||
obj_aspects[aspect.handle] ||= {}
|
||
obj_aspects[aspect.handle].merge!(fetch_attributes_data(taken_attr_list, expert_attributes, admin_attributes))
|
||
... | ... | |
end
|
||
end
|
||
|
||
unless aspect_data[:presentation][:associated_relations].empty?
|
||
taken_rel_list = aspect_data[:presentation][:associated_relations] & rel_list
|
||
unless aspect_data[:mapping][:associated_relations].empty?
|
||
taken_rel_list = aspect_data[:mapping][:associated_relations] & rel_list
|
||
unless taken_rel_list.empty?
|
||
obj_aspects[aspect.handle] ||= {}
|
||
obj_aspects[aspect.handle].merge!(fetch_relations_data(taken_rel_list, expert_attributes))
|
||
... | ... | |
|
||
# manage general attributes
|
||
obj_info = {}
|
||
if self.class.parameters[:presentation][:associate_unclaimed_attributes]
|
||
if self.class.parameters[:mapping][:associate_unclaimed_attributes]
|
||
taken_attr_list = attr_list
|
||
else
|
||
taken_attr_list = admin_attributes
|
||
taken_attr_list += self.class.parameters[:presentation][:associated_attributes]
|
||
taken_attr_list += self.class.parameters[:mapping][:associated_attributes]
|
||
taken_attr_list += self.class.possible_attributes
|
||
end
|
||
taken_attr_list = taken_attr_list.uniq & attr_list
|
||
... | ... | |
attr_list -= taken_attr_list
|
||
|
||
# manage general relations
|
||
if self.class.parameters[:presentation][:associated_relations]
|
||
taken_rel_list = self.class.parameters[:presentation][:associated_relations] & rel_list
|
||
if self.class.parameters[:mapping][:associated_relations]
|
||
taken_rel_list = self.class.parameters[:mapping][:associated_relations] & rel_list
|
||
unless taken_rel_list.empty?
|
||
obj_info.merge!(fetch_relations_data(taken_rel_list, expert_attributes))
|
||
rel_list -= taken_rel_list
|
Also available in: Unified diff
[cleanup] reorganized config