Revision fe532158
Added by Marc Dequènes about 15 years ago
- ID fe5321583c8106fea27459cdd67b852b00075c8d
bin/shadowwalker | ||
---|---|---|
search_base = loc_item.dn
|
||
end
|
||
|
||
if $program_options[:tree_all_objects]
|
||
dn_list = ActiveLdap::Base.search(:base => search_base, :scope => :sub, :attributes => ['']).collect do |entry|
|
||
ActiveLdap::DistinguishedName.parse(entry.first)
|
||
end
|
||
else
|
||
dn_list = []
|
||
sconfig = $shadow.get_config()
|
||
|
||
(sconfig[:presentation][:tree_objects] || []).each do |obj_hdl|
|
||
obj_klass = $shadow.get_object(obj_hdl.downcase)
|
||
unless obj_klass
|
||
raise PreProcessingError, _("Location object '%s' not defined") % obj_hdl
|
||
end
|
||
|
||
obj_klass.find(:all, :base => search_base, :scope => :sub).each do |obj|
|
||
dn_list << obj.dn_obj
|
||
end
|
||
end
|
||
end
|
||
|
||
base_dn = ActiveLdap::DistinguishedName.parse(Elements::LdapObject.base)
|
||
|
||
tree = {}
|
||
dn_list.each do |dn|
|
||
ptree = tree
|
||
pdn = nil
|
||
(dn - base_dn).to_s.split(',').reverse.each do |pdn|
|
||
ptree[pdn] = {} unless ptree.has_key?(pdn)
|
||
ptree = ptree[pdn]
|
||
end
|
||
ptree = nil
|
||
end
|
||
tree = {base_dn => tree}
|
||
tree = $shadow.tree(search_base, $program_options[:debug], $program_options[:tree_all_objects])
|
||
|
||
Display.display_hash_tree(tree, 0)
|
||
end
|
Also available in: Unified diff
[evol] improve tree display, and move code out of shadowwalker