Class Auth_cyrsql

Description

The Auth_cyrsql class provides a SQL implementation of the Horde authentication system for the Cyrus IMAP server. Most of the functionality is the same as for the SQL class; only what is different overrides the parent class implementations.

Required parameters:

   'cyradmin'  The username of the cyrus administrator.
   'cyrpass'   The password for the cyrus administrator.
   'imap_dsn'  The full IMAP DSN
               (i.e. {localhost:993/imap/ssl/novalidate-cert}).
   'phptype'   The database type (ie. 'pgsql', 'mysql', etc.).

Optional parameters:

   'domain_field'    If set to anything other than 'none' this is used as
                     field name where domain is stored.
                     DEFAULT: 'domain_name'
   'encryption'      The encryption to use to store the password in the
                     table (e.g. plain, crypt, md5-hex, md5-base64, smd5,
                     sha, ssha).
                     DEFAULT: 'md5-hex'
   'folders'         An array of folders to create under username.
                     DEFAULT: NONE
   'password_field'  The name of the password field in the auth table.
                     DEFAULT: 'password'
   'quota'           The quota (in kilobytes) to grant on the mailbox.
                     DEFAULT: NONE
   'table'           The name of the auth table in 'database'.
                     DEFAULT: 'accountuser'
   'unixhier'        The value of imapd.conf's unixhierarchysep setting.
                     Set this to true if the value is true in imapd.conf.
   'username_field'  The name of the username field in the auth table.
                     DEFAULT: 'username'
'hidden_accounts' An array of system accounts to hide from the user interface.

Required by some database implementations:

   'database'  The name of the database.
   'hostspec'  The hostname of the database server.
   'protocol'  The communication protocol ('tcp', 'unix', etc.).
   'username'  The username with which to connect to the database.
   'password'  The password associated with 'username'.
   'options'   Additional options to pass to the database.
   'port'      The port on which to connect to the database.
   'tty'       The TTY on which to connect to the database.

The table structure for the auth system is as follows:

 CREATE TABLE accountuser (
     username    VARCHAR(255) BINARY NOT NULL DEFAULT '',
     password    VARCHAR(32) BINARY NOT NULL DEFAULT '',
     prefix      VARCHAR(50) NOT NULL DEFAULT '',
     domain_name VARCHAR(255) NOT NULL DEFAULT '',
     UNIQUE KEY username (username)
 );

 CREATE TABLE adminuser (
     username    VARCHAR(50) BINARY NOT NULL DEFAULT '',
     password    VARCHAR(50) BINARY NOT NULL DEFAULT '',
     type        INT(11) NOT NULL DEFAULT '0',
     SID         VARCHAR(255) NOT NULL DEFAULT '',
     home        VARCHAR(255) NOT NULL DEFAULT '',
     PRIMARY KEY (username)
 );

 CREATE TABLE alias (
     alias       VARCHAR(255) NOT NULL DEFAULT '',
     dest        LONGTEXT,
     username    VARCHAR(50) NOT NULL DEFAULT '',
     status      INT(11) NOT NULL DEFAULT '1',
     PRIMARY KEY (alias)
 );

 CREATE TABLE domain (
     domain_name VARCHAR(255) NOT NULL DEFAULT '',
     prefix      VARCHAR(50) NOT NULL DEFAULT '',
     maxaccounts INT(11) NOT NULL DEFAULT '20',
     quota       INT(10) NOT NULL DEFAULT '20000',
     transport   VARCHAR(255) NOT NULL DEFAULT 'cyrus',
     freenames   ENUM('YES','NO') NOT NULL DEFAULT 'NO',
     freeaddress ENUM('YES','NO') NOT NULL DEFAULT 'NO',
     PRIMARY KEY (domain_name),
     UNIQUE KEY prefix (prefix)
 );

 CREATE TABLE domainadmin (
     domain_name VARCHAR(255) NOT NULL DEFAULT '',
     adminuser   VARCHAR(255) NOT NULL DEFAULT ''
 );

 CREATE TABLE search (
     search_id   VARCHAR(255) NOT NULL DEFAULT '',
     search_sql  TEXT NOT NULL,
     perpage     INT(11) NOT NULL DEFAULT '0',
     timestamp   TIMESTAMP(14) NOT NULL,
     PRIMARY KEY (search_id),
     KEY search_id (search_id)
 );

 CREATE TABLE virtual (
     alias       VARCHAR(255) NOT NULL DEFAULT '',
     dest        LONGTEXT,
     username    VARCHAR(50) NOT NULL DEFAULT '',
     status      INT(11) NOT NULL DEFAULT '1',
     KEY alias (alias)
 );

 CREATE TABLE log (
     id          INT(11) NOT NULL AUTO_INCREMENT,
     msg         TEXT NOT NULL,
     user        VARCHAR(255) NOT NULL DEFAULT '',
     host        VARCHAR(255) NOT NULL DEFAULT '',
     time        DATETIME NOT NULL DEFAULT '2000-00-00 00:00:00',
     pid         VARCHAR(255) NOT NULL DEFAULT '',
     PRIMARY KEY (id)
 );

$Horde: framework/Auth/Auth/cyrsql.php,v 1.33.10.19 2009/01/06 15:22:49 jan Exp $

Copyright 2002-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://opensource.org/licenses/lgpl-license.php.

Located in /Auth/Auth/cyrsql.php (line 137)

Auth
   |
   --Auth_sql
      |
      --Auth_cyrsql
Variable Summary
Method Summary
 Auth_cyrsql Auth_cyrsql ([array $params = array()])
 mixed addUser (string $userId, array $credentials)
 mixed listUsers ()
 boolean removeUser (string $userId)
 mixed updateUser (string $oldID, string $newID, array $credentials)
Variables
IMAP_Admin $_admin (line 151)

Handle for an IMAP_Admin object.

resource $_imapStream (line 144)

Handle for the current IMAP connection.

string $_separator = '.' (line 158)

Hierarchy separator to use (e.g., is it user/mailbox or user.mailbox)

Inherited Variables

Inherited from Auth_sql

Auth_sql::$capabilities
Auth_sql::$_connected
Auth_sql::$_db
Auth_sql::$_write_db

Inherited from Auth

Auth::$_authCredentials
Auth::$_params
Methods
Constructor Auth_cyrsql (line 165)

Constructor.

Auth_cyrsql Auth_cyrsql ([array $params = array()])
  • array $params: A hash containing connection parameters.
addUser (line 260)

Add a set of authentication credentials.

  • return: True on success or a PEAR_Error object on failure.
mixed addUser (string $userId, array $credentials)
  • string $userId: The userId to add.
  • array $credentials: The credentials to add.

Redefinition of:
Auth_sql::addUser()
Add a set of authentication credentials.
listUsers (line 379)

List all users in the system.

  • return: The array of userIds, or false on failure/unsupported.
mixed listUsers ()

Redefinition of:
Auth_sql::listUsers()
List all users in the system.
removeUser (line 328)

Delete a set of authentication credentials.

  • return: Success or failure.
boolean removeUser (string $userId)
  • string $userId: The userId to delete.

Redefinition of:
Auth_sql::removeUser()
Delete a set of authentication credentials.
updateUser (line 437)

Update a set of authentication credentials.

  • return: True on success or a PEAR_Error object on failure.
mixed updateUser (string $oldID, string $newID, array $credentials)
  • string $oldID: The old userId.
  • string $newID: The new userId.
  • array $credentials: The new credentials

Redefinition of:
Auth_sql::updateUser()
Update a set of authentication credentials.

Inherited Methods

Inherited From Auth_sql

 Auth_sql::Auth_sql()
 Auth_sql::addUser()
 Auth_sql::exists()
 Auth_sql::listUsers()
 Auth_sql::removeUser()
 Auth_sql::resetPassword()
 Auth_sql::updateUser()

Inherited From Auth

 Auth::addHook()
 Auth::addLogoutParameters()
 Auth::addUser()
 Auth::authenticate()
 Auth::clearAuth()
 Auth::exists()
 Auth::factory()
 Auth::genRandomPassword()
 Auth::getAuth()
 Auth::getAuthDomain()
 Auth::getBareAuth()
 Auth::getCredential()
 Auth::getCryptedPassword()
 Auth::getDriver()
 Auth::getLoginScreen()
 Auth::getLogoutReason()
 Auth::getLogoutReasonString()
 Auth::getParam()
 Auth::getProvider()
 Auth::getSalt()
 Auth::hasCapability()
 Auth::isAdmin()
 Auth::isAuthenticated()
 Auth::isPasswordChangeRequested()
 Auth::listUsers()
 Auth::readSessionData()
 Auth::removeHook()
 Auth::removeUser()
 Auth::removeUserData()
 Auth::setAuth()
 Auth::setCredential()
 Auth::singleton()
 Auth::transparent()
 Auth::updateUser()
 Auth::_authenticate()
 Auth::_isAdmin()

Documentation generated on Sun, 30 Jan 2011 05:16:18 +0000 by phpDocumentor 1.4.3