diff --git a/include/simpleplugin/attributes/class_CompositeAttribute.inc b/include/simpleplugin/attributes/class_CompositeAttribute.inc index 522a14f539e0dc451ca9232322398e41eda01c7b..6c7d080da1b03b3f8f0429b0c84a9e934f936808 100644 --- a/include/simpleplugin/attributes/class_CompositeAttribute.inc +++ b/include/simpleplugin/attributes/class_CompositeAttribute.inc @@ -261,17 +261,6 @@ class CompositeAttribute extends Attribute } } - function deserializeValue($values) - { - if ($this->visible) { - foreach ($this->attributes as &$attribute) { - $attribute->setDisabled($this->disabled); - $attribute->deserializeValue($values); - } - unset($attribute); - } - } - function renderFormInput() { $display = ""; diff --git a/include/simpleplugin/attributes/class_FileAttribute.inc b/include/simpleplugin/attributes/class_FileAttribute.inc index 8fad4071c3a212ceccdcc02e9e90a46269219dd4..a7a2455e4f7a3a969dcd7d1b81c4eac6ca2a0c18 100644 --- a/include/simpleplugin/attributes/class_FileAttribute.inc +++ b/include/simpleplugin/attributes/class_FileAttribute.inc @@ -94,16 +94,17 @@ class FileAttribute extends Attribute /*! \brief Apply value from RPC requests * - * \param array $values the values array + * \param mixed $value the value */ - function deserializeValue($values) + function deserializeValue($value) { - if (isset($values[$this->getLdapName()])) { - if ($this->binary) { - $this->setValue(base64_decode($values[$this->getLdapName()])); - } else { - $this->setValue($values[$this->getLdapName()]); - } + if ($this->disabled) { + return sprintf(_('Attribute %s is disabled, its value could not be set'), $this->getLdapName()); + } + if ($this->binary) { + $this->setValue(base64_decode($value)); + } else { + $this->setValue($value); } } } diff --git a/include/simpleplugin/class_Attribute.inc b/include/simpleplugin/class_Attribute.inc index 52338aa0145d36ffd5990c894588e749bb32fc30..d4a30e50634eb7cf1e0579815d4764c1afef2910 100644 --- a/include/simpleplugin/class_Attribute.inc +++ b/include/simpleplugin/class_Attribute.inc @@ -635,11 +635,12 @@ class Attribute * * \param array $values the values array */ - function deserializeValue($values) + function deserializeValue($value) { - if (isset($values[$this->getLdapName()])) { - $this->setValue($values[$this->getLdapName()]); + if ($this->disabled) { + return sprintf(_('Attribute %s is disabled, its value could not be set'), $this->getLdapName()); } + $this->setValue($values[$this->getLdapName()]); } /*! \brief Add ACL information around display diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index cf1596c18cdf1d8efd1fb8dfc11bafc6112ee5ef..d95c17b62eb2c883bd522ec4ca83f5e7349cdfda 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -1914,7 +1914,10 @@ class simplePlugin foreach ($values as $name => $value) { if (isset($this->attributesAccess[$name])) { if (!$checkAcl || $this->attrIsWriteable($name)) { - $this->attributesAccess[$name]->setValue($value); + $error = $this->attributesAccess[$name]->deserializeValue($value); + if (!empty($error)) { + return $error; + } } else { return msgPool::permModify($this->dn, $name); }