Fix addDomain method

This commit is contained in:
Victor LABORIE 2017-12-14 00:32:58 +01:00
parent 8c91f6ff2a
commit 458685d42f

View file

@ -67,7 +67,7 @@ class LdapServer {
return $this->domains;
}
public function addDomain($name,$active=false) {
public function addDomain($name,$active='FALSE') {
global $conf;
$info["cn"]=$name;
$info["objectclass"][0] = ($conf['evoadmin']['version'] == 1) ? 'ldapDomain' : 'postfixDomain';
@ -76,10 +76,9 @@ class LdapServer {
$info["isActive"] = $active;
$info["gidNumber"]= getfreegid();
if (ldap_add($this->conn, "cn=".$name.",".LDAP_BASE, $info)) {
return true;
} else {
return false;
if (!@ldap_add($this->conn, "cn=".$name.",".LDAP_BASE, $info)) {
$error = ldap_error($this->conn);
throw new Exception("Erreur dans l'ajout du domaine : $error");
}
}