Project

General

Profile

« Previous | Next » 

Revision 5ec5940f

Added by Marc Dequènes about 13 years ago

  • ID 5ec5940f41e1e9535c6e6a625de0f3bca78a226e

[evol] attributes parameters rework §10 (access support for modify operation) (refs #142)

View differences:

lib/ldap_shadows/elements/object.rb
raise PreProcessingError, _("No such field '%s' in object '%s'") % [field, self.class.handle]
end
attr_info = self.attribute_info(field)
# TODO: not so beautiful…
obj_info, obj_aspects = self.organized_data
fields_info = obj_info.merge(obj_aspects.values.inject{|d1, d2| d1.merge(d2) } || {})
attr_info = fields_info[field]
if attr_info[:read_only]
raise PreProcessingError, _("The field '%s' cannot be modified (read only)") % field
end
if ['read_only', 'forbidden'].include? attr_info[:access]
raise PreProcessingError, _("The field '%s' cannot be modified (forbidden)") % field
end
if attr_info[:syntax] == "1.3.6.1.4.1.1466.115.121.1.12"
if val =~ FULL_HANDLE_PATTERN
obj_hdl = $1.downcase
......
raise PreProcessingError, _("No such relation '%s' for object '%s'") % [rel, self.class.handle]
end
rel_info = self.class.relations_info[rel.to_sym]
# TODO: not so beautiful…
obj_info, obj_aspects = self.organized_data
fields_info = obj_info.merge(obj_aspects.values.inject{|d1, d2| d1.merge(d2) } || {})
rel_info = fields_info['rel:' + rel]
if rel_info[:read_only]
raise PreProcessingError, _("The relation '%s' cannot be modified (read only)") % rel
end
if ['read_only', 'forbidden'].include? rel_info[:access]
raise PreProcessingError, _("The field '%s' cannot be modified (forbidden)") % rel
end
if val.blank?
raise PreProcessingError, _("No item handle specified for relation '%s'") % rel
end
......
nil
else
attr_data = attribute_parameters(rel, claimed_by)
attr_data.merge!(self.class.relations_info[rel.to_sym])
attr_data.merge!({
:syntax => nil,

Also available in: Unified diff