Horde_Auth_Ldap::removeUser PHP Method

removeUser() public method

Remove a set of authentication credentials.
public removeUser ( string $userId, string $dn = null )
$userId string The userId to add.
$dn string TODO
    public function removeUser($userId, $dn = null)
    {
        if (!empty($this->_params['ad'])) {
            throw new Horde_Auth_Exception(__CLASS__ . ': Removing users is not supported for Active Directory');
        }
        if (is_null($dn)) {
            /* Search for the user's full DN. */
            try {
                $dn = $this->_ldap->findUserDN($userId);
            } catch (Horde_Exception_Ldap $e) {
                throw new Horde_Auth_Exception($e);
            }
        }
        try {
            $this->_ldap->delete($dn);
        } catch (Horde_Ldap_Exception $e) {
            throw new Horde_Auth_Exception(sprintf(__CLASS__ . ': Unable to remove user "%s"', $userId));
        }
    }

Usage Example

示例#1
0
文件: Ldap.php 项目: jubinpatel/horde
 /**
  * Delete a set of authentication credentials.
  *
  * @param string $userId  The user ID to delete.
  * @param string $dn      NOT USED.
  *
  * @throws Horde_Auth_Exception
  */
 public function removeUser($userId, $dn = null)
 {
     list($userId, $credentials) = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Auth')->create()->runHook($userId, array(), 'preauthenticate', 'admin');
     parent::removeUser($userId, isset($credentials['ldap']) ? $credentials['ldap']['dn'] : null);
 }