Horde_Group_Ldap::_setData PHP Méthode

_setData() protected méthode

Sets one or more attributes of a group.
protected _setData ( mixed $gid, array | string $attribute, string $value = null )
$gid mixed A group ID.
$attribute array | string An attribute name or a hash of attributes.
$value string An attribute value if $attribute is a string.
    protected function _setData($gid, $attribute, $value = null)
    {
        if ($this->readOnly()) {
            throw new Horde_Group_Exception('This group backend is read-only.');
        }
        $attributes = is_array($attribute) ? $attribute : array($attribute => $value);
        try {
            $entry = $this->_ldap->getEntry($gid);
            foreach ($attributes as $attribute => $value) {
                switch ($attribute) {
                    case 'name':
                        $attribute = $this->_params['gid'];
                        break;
                    case 'email':
                        $attribute = 'mail';
                        break;
                }
                $entry->replace(array($attribute => $value));
            }
            $this->_rebind(true);
            $entry->update();
            $this->_rebind(false);
        } catch (Horde_Ldap_Exception $e) {
            throw new Horde_Group_Exception($e);
        }
    }