Project

General

Profile

« Previous | Next » 

Revision c331fe49

Added by Marc Dequènes over 14 years ago

  • ID c331fe496ad1561adfb5d9c0ef3e7554e9a0a5ff

[evol] rework how object/aspect classes are generated and ensure each shadow materials is in a proper container (to allow loading multiple shadows)

View differences:

lib/ldap_shadows/object.rb
class LdapObject < ActiveLdap::Base
include Hooks
class_inheritable_accessor :handle, :presentation, :shadow, :relations_info
class_inheritable_accessor :presentation, :relations_info
ldap_mapping :prefix => '', :classes => ['top'], :scope => :sub
......
end
def organized_data
ignored_attrs = self.shadow.get_shadow_config[:hidden_attributes] || []
ignored_attrs = self.class.shadow.get_shadow_config[:hidden_attributes] || []
ignored_attrs += self.class.presentation[:hidden_attributes] || []
attr_list = self.nonempty_attributes - ignored_attrs
......
def self.ldap_search_string_aspects(field, op, val_list)
ldap_search_parts = val_list.split(",").collect do |val|
aspect_data = self.shadow.get_aspect(val)
aspect_data = self.class.shadow.get_aspect(val)
raise PreProcessingError, _("No such aspect '%s'") % val if aspect_data.nil?
ldap_classes = aspect_data[:mapping][:classes]
......
end
def self.find_raw_item_object(raw_item)
self.shadow.objects.each do |obj_hdl|
self.class.shadow.objects.each do |obj_hdl|
obj_klass = $ldapctl.find_klass(obj_hdl)
ldap_classes = obj_klass.required_classes
return obj_hdl if raw_item.classes & ldap_classes == ldap_classes
......
def add_aspect(aspect)
return unless self.class.possible_aspects.include?(aspect)
aspect_data = self.shadow.get_aspect(aspect)
aspect_data = self.class.shadow.get_aspect(aspect)
add_class(*aspect_data[:mapping][:classes])
# recursive dependency enforcement
......
def remove_aspect(aspect)
return unless self.class.possible_aspects.include?(aspect)
aspect_data = self.shadow.get_aspect(aspect)
aspect_data = self.class.shadow.get_aspect(aspect)
remove_class(*aspect_data[:mapping][:classes])
end

Also available in: Unified diff