You are here

public function SimpleLdapRole::delete in Simple LDAP 7

Same name and namespace in other branches
  1. 7.2 simple_ldap_role/SimpleLdapRole.class.php \SimpleLdapRole::delete()

Delete the role from the LDAP directory.

@throw SimpleLdapException

Return value

boolen TRUE on success.

File

simple_ldap_role/SimpleLdapRole.class.php, line 259
SimpleLdapRole class file.

Class

SimpleLdapRole
@file SimpleLdapRole class file.

Code

public function delete() {
  try {
    if ($this->move) {
      $this->server
        ->delete($this->move);
    }
    else {
      $this->server
        ->delete($this->dn);
    }
  } catch (SimpleLdapException $e) {
    switch ($e
      ->getCode()) {
      case 32:

        // A "No such object" exception was thrown, which means there was no
        // LDAP entry to delete. Just absorb this exception.
        break;
      default:
        throw $e;
    }
  }
  $this->exists = FALSE;
  $this->dirty = FALSE;
  $this->move = FALSE;
  return TRUE;
}