Project

General

Profile

« Previous | Next » 

Revision e04ae9bc

Added by Marc Dequènes over 15 years ago

  • ID e04ae9bcb42fea89f17e0de9f58efc6c8a737346

[evol] 'create' action now ask for a location (which icurrently s a parent object)

View differences:

bin/shadowwalker
self.short_desc = "Create an item"
self.usages_params = [
"<object> <new_item> [<field>=<value>] ..."
"<object> <new_item> <location> [<field>=<value>] ..."
]
end
......
STDERR.puts "syntax error: no item name given"
exit 1
end
if args.size < 3
STDERR.puts "syntax error: no location name given"
exit 1
end
obj_hdl = args.shift
obj_klass = $ldapctl.find_klass(obj_hdl)
......
end
item_hdl = args.shift
location = args.shift
if location =~ /^([a-zA-Z]+)\/(.+)$/
loc_obj_hdl = $1
loc_item_hdl = $2
else
STDERR.puts "syntax error: bad location"
exit 1
end
loc_obj_klass = $ldapctl.find_klass(loc_obj_hdl)
if loc_obj_klass.nil?
STDERR.puts "No such location object '#{loc_obj_hdl}'."
exit 2
end
begin
loc_item = loc_obj_klass.find(loc_item_hdl)
rescue ActiveLdap::EntryNotFound
STDERR.puts "No such item '#{loc_obj_hdl}/#{loc_item_hdl}'"
exit 2
end
item = obj_klass.new(item_hdl)
item.base = loc_item.dn_obj - obj_klass.base_obj
args.each do |param|
param =~ /^([a-zA-Z]+)=(.*)$/
......
begin
cmdparser.parse
rescue ActiveLdap::EntryInvalid => e
# work around #26758
# work around activeldap#26758
STDERR.puts e.to_s.sub(/invalid format: .*: required syntax:/, "invalid format. required syntax:")
exit 3
rescue ActiveLdap::OperationNotPermitted => e
lib/ldap_shadows/object.rb
OPERATIONAL_ATTRIBUTES = ['creatorsName', 'createTimestamp', 'modifiersName', 'modifyTimestamp', 'structuralObjectClass', 'entryUUID']
# temporary method until active_ldap is fixed: return a DN object (see #23932)
# temporary method until active_ldap is fixed: return a DN object (see activeldap#23932)
def dn_obj
ActiveLdap::DistinguishedName.parse(self.dn)
end
# temporary method until active_ldap is fixed: return a DN object (see activeldap#23932)
def self.base_obj
ActiveLdap::DistinguishedName.parse(self.base)
end
def self.find(*args)
obj_stuff = super(*args)
if obj_stuff.is_a? Array
......
value = @data[real_name] || []
next unless self.class.blank_value?(value)
# Duck: workaround for #26720 (not sure it works in all cases)
# workaround for activeldap#26720 (not sure it works in all cases)
next unless @initial_attribute_list.nil? or @initial_attribute_list.include?(real_name)
_schema ||= schema

Also available in: Unified diff