Пример #1
0
 /**
  *
  * @throws BadSearchFilterException
  * @throws NoSuchObjectException
  * @throws InvalidCredentialException
  * @throws AlreadyExistsException
  * @throws LdapException
  */
 public static function throwException(Connection $conn)
 {
     $error = ldap_error($conn->getResource());
     $code = ldap_errno($conn->getResource());
     switch ($code) {
         case -7:
             throw new BadSearchFilterException($error, $code);
         case 32:
             throw new NoSuchObjectException($error, $code);
         case 49:
             throw new InvalidCredentialException($error, $code);
         case 68:
             throw new AlreadyExistsException($error, $code);
     }
     throw new LdapException($error, $code);
 }
Пример #2
0
 /**
  *
  * @param string $dn
  * @throws LdapException
  */
 public function delete($dn)
 {
     $this->checkConnection();
     $resource = $this->conn->getResource();
     $rs = @ldap_delete($resource, $dn);
     if ($rs === false) {
         ErrorHandler::throwException($this->conn);
     }
 }