/**
* Delete a set of authentication credentials.
*
* @param string $userId The userId to delete.
*
* @throws Horde_Auth_Exception
*/
public function removeUser($userId)
{
if (!empty($this->_params['domain_field']) && $this->_params['domain_field'] != 'none') {
list($name, $domain) = explode('@', $userId);
/* Build the SQL query. */
$query = sprintf('DELETE FROM %s WHERE %s = ? and %s = ?', $this->_params['table'], $this->_params['username_field'], $this->_params['domain_field']);
$values = array($name, $domain);
$query2 = 'DELETE FROM virtual WHERE dest = ?';
$values2 = array($userId);
try {
$this->_db->delete($query, $values);
$this->_db->delete($query2, $values2);
} catch (Horde_Db_Exception $e) {
throw new Horde_Auth_Exception($e);
}
} else {
parent::removeUser($userId);
}
/* Set ACL for mailbox deletion. */
list($admin) = explode('@', $this->_params['cyradmin']);
$mailbox = $this->_params['userhierarchy'];
try {
$this->_imap->setACL($mailbox, $admin, array('rights' => 'lrswipcda'));
$this->_imap->deleteMailbox($mailbox);
} catch (Horde_Imap_Client_Exception $e) {
throw new Horde_Auth_Exception($e);
}
}