Project

General

Profile

« Previous | Next » 

Revision d9091cc0

Added by Marc Dequènes almost 15 years ago

  • ID d9091cc02ae51e84b8c55de5262c8d1847121fcf

[evol] added aspects modification support, complain about missing fields (added for creation too), and better list present (non-empty) attributes

View differences:

lib/ldap_shadows/object.rb
end
def load_initial_attribute_list
@initial_attribute_list ||= self.attributes.keys
@initial_attribute_list ||= self.nonempty_attributes
end
def name
......
ignored_attrs = self.mapper.get_global_config[:hidden_attributes] || []
ignored_attrs += self.class.presentation[:hidden_attributes] || []
attr_list = self.attributes.keys - ignored_attrs
attr_list = self.nonempty_attributes - ignored_attrs
aspects = self.aspects
rel_list = self.possible_relations
......
list
end
def add_aspect(aspect)
return unless self.class.possible_aspects.include?(aspect)
aspect_data = self.mapper.get_aspect(aspect)
add_class(*aspect_data[:mapping][:classes])
end
def remove_aspect(aspect)
return unless self.class.possible_aspects.include?(aspect)
aspect_data = self.mapper.get_aspect(aspect)
remove_class(*aspect_data[:mapping][:classes])
end
def nonempty_attributes
self.attributes.collect{|key, val| (val.nil? or val == []) ? nil : key }.compact
end
def missing_attributes
self.must.collect{|attr| attr.name } - self.nonempty_attributes - ['objectClass']
end
protected
def fetch_attributes_data(attr_list, expert_attributes)

Also available in: Unified diff