deco / reco LDAP
This commit is contained in:
parent
5dedf3b183
commit
4fa022c550
|
@ -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(){
|
||||
|
|
Loading…
Reference in New Issue