protected function _create($name, $email = null)
{
if ($this->readOnly()) {
throw new Horde_Group_Exception('This group backend is read-only.');
}
$attributes = array($this->_params['gid'] => $name, 'objectclass' => $this->_params['newgroup_objectclass'], 'gidnumber' => $this->_nextGid());
if (!empty($email)) {
$attributes['mail'] = $email;
}
$dn = Horde_Ldap::quoteDN(array(array($this->_params['gid'], $name))) . ',' . $this->_params['basedn'];
try {
$entry = Horde_Ldap_Entry::createFresh($dn, $attributes);
$this->_rebind(true);
$this->_ldap->add($entry);
$this->_rebind(false);
} catch (Horde_Ldap_Exception $e) {
throw new Horde_Group_Exception($e);
}
return $dn;
}