From ada3b2888610709ae5a686ad84e729a4aa75330b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Mon, 3 Apr 2017 11:08:52 +0200 Subject: [PATCH] Added methods is simplePlugin to add/remove attributes post construct Will be used by dnsHost and mailAccount for instance --- include/simpleplugin/class_simplePlugin.inc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index b2bbdb661..2653908ce 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -503,6 +503,21 @@ class simplePlugin return $attr.'='.ldap_escape_dn($this->attributesAccess[$attr]->computeLdapValue()).','.$ou.$base; } + protected function addAttribute($section, $attr) + { + $name = $attr->getLdapName(); + $this->attributesInfo[$section]['attrs'][$name] = $attr; + $this->attributesAccess[$name] =& $this->attributesInfo[$section]['attrs'][$name]; + $this->attributesAccess[$name]->setParent($this); + unset($this->$name); + } + + protected function removeAttribute($section, $id) + { + unset($this->attributesInfo[$section]['attrs'][$id]); + unset($this->attributesAccess[$id]); + } + /*! * \brief Returns a list of all available departments for this object. * -- GitLab