Project

General

Profile

« Previous | Next » 

Revision c30d4613

Added by Marc Dequènes over 14 years ago

  • ID c30d46135dc6b02049f912f586cfd6b07701bb39

[evol] improved code for objects recognition, created display helper for raw items, and added family items display support

View differences:

lib/ldap_shadows/object.rb
true
end
def self.items_search_from_strings(str_list)
def self.items_find_from_strings(str_list)
ldap_search_objects = "(objectClass=*)"
ldap_search_aspects = ""
ldap_search_fields = []
......
end
ldap_search_string = "(&" + ldap_search_objects + ldap_search_aspects + ldap_search_fields.join + ")"
search(:scope => :sub, :filter => ldap_search_string, :attributes => "objectClass")
LdapObject.find(:all, :scope => :sub, :filter => ldap_search_string, :attributes => ["objectClass"])
end
def self.ldap_search_string_field(field, op, val)
......
self.mapper.objects.each do |obj_hdl|
obj_klass = $ldapctl.find_klass(obj_hdl)
ldap_classes = obj_klass.required_classes
return obj_hdl if raw_item['objectClass'] & ldap_classes == ldap_classes
return obj_hdl if raw_item.classes & ldap_classes == ldap_classes
end
nil
end
def self.raw_item_info(raw_item)
obj_hdl = self.find_raw_item_object(raw_item)
if obj_hdl
obj_klass = $ldapctl.find_klass(obj_hdl)
item = obj_klass.new(raw_item.dn)
{:name => "#{obj_hdl}/#{item.name}", :item => item, :object => obj_klass}
else
{:name => "unknown/#{item_dn}"}
end
end
def family_parent_dn
pdn = self.dn_obj.dup
pdn.shift
pdn
end
def family_parent
# nothing found when using LdapObject, that's weird, so using ActiveLdap::Base
# until further investigation
#LdapObject.find(:first, :base => self.family_parent_dn.to_s, :scope => :base)
ActiveLdap::Base.find(:first, :base => self.family_parent_dn.to_s, :scope => :base)
end
def family_children
LdapObject.find(:all, :base => self.dn, :scope => :one)
end

Also available in: Unified diff