You are here

public function SimpleLdapUser::delete in Simple LDAP 7.2

Same name and namespace in other branches
  1. 7 simple_ldap_user/SimpleLdapUser.class.php \SimpleLdapUser::delete()

Delete user from LDAP directory.

@throw SimpleLdapException

Return value

boolean TRUE on success. FALSE if a save was not performed, which would only happen if a valid DN has not been defined for the object.

File

simple_ldap_user/SimpleLdapUser.class.php, line 336
Class defining a simple LDAP user.

Class

SimpleLdapUser
@file Class defining a simple LDAP user.

Code

public function delete() {
  if ($this->move) {
    $this->server
      ->delete($this->move);
  }
  elseif ($this->dn) {
    $this->server
      ->delete($this->dn);
  }
  else {
    return FALSE;
  }

  // There were no exceptions thrown, so the entry was successfully deleted.
  $this->exists = FALSE;
  $this->dirty = array();
  $this->move = FALSE;
  return TRUE;
}