Revision 2bd92292
Added by Marc Dequènes over 14 years ago
- ID 2bd92292f8692c53b98ab68897904f9eb244ca01
lib/ldap_shadows/shadow.rb | ||
---|---|---|
def tree(search_base, raw = false, all_objects = false)
|
||
item_list = {}
|
||
if all_objects
|
||
# does not work well...
|
||
#Elements::LdapObject.find(:all, :base => search_base, :scope => :sub, :attributes => ['']).each do |item|
|
||
# item_list[item.dn_obj] = item
|
||
#end
|
||
ActiveLdap::Base.find(:all, :base => search_base, :scope => :sub, :attributes => ['']).each do |item|
|
||
item_list[ActiveLdap::DistinguishedName.parse(item.dn)]= item
|
||
end
|
||
... | ... | |
raw_tree = {}
|
||
tree = {}
|
||
|
||
base_dn = ActiveLdap::DistinguishedName.parse(Elements::LdapObject.base)
|
||
base_dn = ActiveLdap::DistinguishedName.parse(ActiveLdap::Base.base)
|
||
dn_list = item_list.keys
|
||
|
||
dn_list.each do |dn|
|
||
... | ... | |
current_item = ActiveLdap::Base.find(:first, :base => current_dn.to_s, :scope => :base, :attributes => [''])
|
||
item_list[current_dn] = current_item
|
||
end
|
||
p_item = Elements::LdapObject.raw_item_info(self, item_list[current_dn])[:name]
|
||
p_item = LdapShadows::Manipulation.raw_item_info(self, item_list[current_dn])[:name]
|
||
end
|
||
|
||
unless p_raw_tree.has_key?(p_dn)
|
||
... | ... | |
res = {base_dn.to_s => raw_tree}
|
||
else
|
||
base_obj = ActiveLdap::Base.find(:first, :base => base_dn.to_s, :scope => :base, :attributes => [''])
|
||
res = {Elements::LdapObject.raw_item_info(self, base_obj)[:name] => tree}
|
||
res = {LdapShadows::Manipulation.raw_item_info(self, base_obj)[:name] => tree}
|
||
end
|
||
|
||
res
|
Also available in: Unified diff
[cleanup] moved helper things out of LdapObject in Manipulation and began sweeping dust