The table structure for the Auth system needs to be created with the shipped migration scripts. See "horde-db-migrate-component --help" for details.
Author: Chuck Hagenbuch (chuck@horde.org)
Inheritance: extends Horde_Auth_Base
Exemplo n.º 1
0
 /**
  * Checks if a userId exists in the system.
  *
  * @param string $userId  User ID for which to check
  *
  * @return boolean  Whether or not the userId already exists.
  */
 public function exists($userId)
 {
     if (empty($this->_params['query_exists'])) {
         return parent::exists($userId);
     }
     /* Build a custom query, based on the config file. */
     $query = str_replace('\\L', $this->_db->quote($userId), $this->_params['query_exists']);
     try {
         return (bool) $this->_db->selectValue($query);
     } catch (Horde_Db_Exception $e) {
         return false;
     }
 }
Exemplo n.º 2
0
 /**
  * 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);
     }
 }