Project

General

Profile

« Previous | Next » 

Revision 4ca7cd95

Added by Marc Dequènes about 15 years ago

  • ID 4ca7cd95494f48ab3aa67d09e6235caf69384b7e

[cleanup] removed a now useless global variable

View differences:

bin/shadowwalker
config = LdapShadows::Config.instance
config.load_global_config([File.join(ENV['HOME'], ".shadowwalker")])
begin
$shadow = config.load_shadow($program_options[:shadow_name])
@shadow = config.load_shadow($program_options[:shadow_name])
rescue ActiveLdap::Error => e
STDERR.puts _("LDAP connection error: %s") % e.to_s
exit 2
......
item_hdl = m[2]
if fetch_item
item = LdapShadows::Manipulation.find_item_by_full_handle($shadow, full_handle, $program_options[:admin])
item = LdapShadows::Manipulation.find_item_by_full_handle(@shadow, full_handle, $program_options[:admin])
[item.class, item]
else
obj_klass = params_shift_object_handle([obj_hdl])
......
raise SyntaxError, _("no object name given") if args.empty?
obj_hdl = args.shift.downcase.singularize
obj_klass = $shadow.get_object(obj_hdl)
obj_klass = @shadow.get_object(obj_hdl)
raise PreProcessingError, _("No such object '%s'") % obj_hdl if obj_klass.nil?
obj_klass
end
......
obj_hdl = args.shift.downcase.singularize
case obj_hdl
when ':object'
list = $shadow.objects
list = @shadow.objects
puts "=== List of LDAP objects (#{list.size}) ==="
list.each do |obj_name|
puts " - #{obj_name}"
......
result_is_binary = attr_info.binary?
unless result_is_binary or $program_options[:debug]
result = LdapShadows::Manipulation.interpret_field_value($shadow, attr_info.syntax.to_param, result)
result = LdapShadows::Manipulation.interpret_field_value(@shadow, attr_info.syntax.to_param, result)
if result.nil?
raise PreProcessingError, _("Field '%s' in object '%s' has a weird value") % [field_name, obj_klass.handle]
end
......
search_base = loc_item.dn
end
tree = $shadow.tree(search_base, $program_options[:debug], $program_options[:tree_all_objects])
tree = @shadow.tree(search_base, $program_options[:debug], $program_options[:tree_all_objects])
Display.display_hash_tree(tree, 0)
end
......
raise SyntaxError, _("no search arguments") if args.empty?
res = LdapShadows::Manipulation.items_find_from_strings($shadow, args)
res = LdapShadows::Manipulation.items_find_from_strings(@shadow, args)
unless res.empty?
display_lines = []
res.each do |raw_item|
display_lines << LdapShadows::Manipulation.raw_item_info($shadow, raw_item)[:name]
display_lines << LdapShadows::Manipulation.raw_item_info(@shadow, raw_item)[:name]
end
puts display_lines.join("\n")
end

Also available in: Unified diff