Project

General

Profile

« Previous | Next » 

Revision 458f7c28

Added by Marc Dequènes about 15 years ago

  • ID 458f7c287463d610baa96fc027f5e50a69bb1f76

[evol] limit parent location/type for item creation (not yet properly integrated)

View differences:

bin/shadowwalker
obj_klass, item_hdl = params_shift_item_handle_full_handle(args, false)
loc_obj_klass, loc_item = params_shift_item_handle_full_handle(args, true, "parent full-handle")
# TODO: move this in LdapShadows::Manipulation
p_hdl_restr = obj_klass.parameters[:mapping][:parent_handle_restrictions]
unless p_hdl_restr.nil? or loc_item.full_handle =~ Regexp.new(p_hdl_restr)
raise PreProcessingError, _("This parent can't raise such a child (handle restrictions)")
end
p_dn_restr = obj_klass.parameters[:mapping][:parent_dn_restrictions]
unless p_dn_restr.nil? or loc_item.dn =~ Regexp.new(p_dn_restr)
raise PreProcessingError, _("This parent can't raise such a child (DN restrictions)")
end
item = obj_klass.new(item_hdl)
item.base = loc_item.dn_obj - obj_klass.base_obj
modification_done = LdapShadows::Manipulation.item_modify_from_strings(item, args)
item.save!
#item.save!
puts "Creation done."
end
end

Also available in: Unified diff