deco / reco LDAP

This commit is contained in:
afornerot 2021-01-27 15:39:12 +01:00
parent 5dedf3b183
commit 4fa022c550

View File

@ -45,6 +45,8 @@ class ldapService
}
public function connect() {
$this->disconnect();
if($this->connection){
return $this->connection;
} else {
@ -82,11 +84,8 @@ class ldapService
}
public function rename($oldDN, $newDN, $parentDN = '', $deleteOldDN = true){
$connection = $this->connect();
$result = ldap_rename($connection, $oldDN, $newDN, $parentDN, $deleteOldDN);
if(!$result) $this->ldapError();
return $result;
}
@ -124,8 +123,10 @@ class ldapService
}
public function disconnect(){
$connection = $this->connect();
ldap_unbind($connection);
if($this->connection) {
ldap_unbind($this->connection);
$this->connection=null;
}
}
public function ldapError(){