__construct() public method

Constructor
public __construct ( array $params = [] )
$params array Parameters: 'db' - (Horde_Db_Adapter) [REQUIRED] Database object.
'encryption' - (string) The encryption to use to store the password in
               the table (e.g. plain, crypt, md5-hex, md5-base64, smd5,
               sha, ssha, aprmd5).
               DEFAULT: 'md5-hex'
'hard_expiration_field' - (string) The name of the field containing a
                          date after which the account is no longer
                          valid and the user will not be able to log in
                          at all.
                          DEFAULT: none
'password_field' - (string) The name of the password field in the auth
                   table.
                   DEFAULT: 'user_pass'
'show_encryption' - (boolean) Whether or not to prepend the encryption
                    in the password field.
                    DEFAULT: false
'soft_expiration_field' - (string) The name of the field containing a
                          date after which the system will request the
                          user change his or her password.
                          DEFAULT: none
'table' - (string) The name of the SQL table to use in 'database'.
          DEFAULT: 'horde_users'
'username_field' - (string) The name of the username field in the auth
                   table.
                   DEFAULT: 'user_uid'
示例#1
0
 /**
  * Constructor.
  *
  * Some special tokens can be used in the SQL query. They are replaced
  * at the query stage:
  *   '\L' will be replaced by the user's login
  *   '\P' will be replaced by the user's password.
  *   '\O' will be replaced by the old user's login (required for update)
  *
  * Eg: "SELECT * FROM users WHERE uid = \L
  *                          AND passwd = \P
  *                          AND billing = 'paid'"
  *
  * @param array $params  Configuration parameters:
  *   - query_auth:          (string) Authenticate the user. ('\L' & '\P')
  *   - query_add:           (string) Add user. ('\L' & '\P')
  *   - query_getpw:         (string) Get one user's password. ('\L')
  *   - query_update:        (string) Update user. ('\O', '\L' & '\P')
  *   - query_resetpassword: (string) Reset password. ('\L', & '\P')
  *   - query_remove:        (string) Remove user. ('\L')
  *   - query_list:          (string) List user.
  *   - query_exists:        (string) Check for existance of user. ('\L')
  */
 public function __construct(array $params = array())
 {
     foreach (array('query_auth', 'query_add', 'query_update', 'query_resetpassword', 'query_remove', 'query_list') as $val) {
         if (empty($params[$val])) {
             switch ($val) {
                 case 'query_auth':
                     $this->_capabilities['authenticate'] = false;
                     break;
                 case 'query_add':
                     $this->_capabilities['add'] = false;
                     break;
                 case 'query_update':
                     $this->_capabilities['update'] = false;
                     break;
                 case 'query_resetpassword':
                     $this->_capabilities['resetpassword'] = false;
                     break;
                 case 'query_remove':
                     $this->_capabilities['remove'] = false;
                     break;
                 case 'query_list':
                     $this->_capabilities['list'] = false;
                     break;
             }
         }
     }
     parent::__construct($params);
 }
示例#2
0
 /**
  * Constructor.
  *
  * @param array $params  Parameters:
  *   - domain_field: (string) If set to anything other than 'none' this is
  *                   used as field name where domain is stored.
  *                   DEFAULT: 'domain_name'
  *   - folders: (array) An array of folders to create under username.
  *                DEFAULT: NONE
  *   - hidden_accounts: (array) An array of system accounts to hide from
  *                      the user interface.
  *                      DEFAULT: None.
  *   - imap: (Horde_Imap_Client_Base) [REQUIRED] An IMAP client object.
  *   - quota: (integer) The quota (in kilobytes) to grant on the mailbox.
  *            DEFAULT: NONE
  *   - userhierarchy: (string) The user hierarchy prefix (UTF-8).
  *                    DEFAULT: 'user.'
  *
  * @throws InvalidArgumentException
  */
 public function __construct(array $params = array())
 {
     if (!isset($params['imap']) || !$params['imap'] instanceof Horde_Imap_Client_Base) {
         throw new InvalidArgumentException('Missing imap parameter.');
     }
     $this->_imap = $params['imap'];
     unset($params['imap']);
     $params = array_merge(array('domain_field' => 'domain_name', 'folders' => array(), 'hidden_accounts' => array('cyrus'), 'quota' => null, 'userhierarchy' => 'user.'), $params);
     parent::__construct($params);
 }