/** * Constructor. * * @param string $user The username. * @param array $params Configuration parameters. * <pre> * - collection: (string) The collection name. * - mongo_db: (Horde_Mongo_Client) [REQUIRED] A MongoDB client object. * </pre> */ public function __construct($user, array $params = array()) { if (!isset($params['mongo_db'])) { throw new InvalidArgumentException('Missing mongo_db parameter.'); } parent::__construct($user, array_merge(array('collection' => 'horde_prefs'), $params)); $this->_db = $this->_params['mongo_db']->selectCollection(null, $this->_params['collection']); }
public function __construct($user, array $params = array()) { if (empty($params['imsp'])) { throw new InvalidArguementException('Missing required imsp parameter.'); } $this->_imsp = $params['imsp']; parent::__construct($user, $params); }
/** * Constructor. * * @param string $user The username. * @param array $params Configuration parameters: * - db: (Horde_Db_Adapter) [REQUIRED] The DB * instance. * - table: (string) The name of the prefs table. * DEFAULT: 'horde_prefs' * * @throws InvalidArgumentException */ public function __construct($user, array $params = array()) { if (!isset($params['db'])) { throw new InvalidArgumentException('Missing db parameter.'); } $this->_db = $params['db']; unset($params['db']); $params = array_merge(array('table' => 'horde_prefs'), $params); parent::__construct($user, $params); }
/** * Constructor. * * @param string $user The username. * @param array $params Configuration parameters: * <pre> * 'directory' - (string) [REQUIRED] Preference storage directory. * </pre> * * @throws InvalidArgumentException */ public function __construct($user, array $params = array()) { // Sanity check for directory if (empty($params['directory']) || !is_dir($params['directory'])) { throw new InvalidArgumentException('Preference storage directory is not available.'); } if (!is_writable($params['directory'])) { throw new InvalidArgumentException(sprintf('Directory %s is not writeable.', $params['directory'])); } parent::__construct($user, $params); $this->_fullpath = $this->_params['directory'] . '/' . basename($this->_params['user']) . '.prefs'; }
/** * Constructor. * * @param string $user The username. * @param array $params Configuration parameters. * <pre> * 'kolab' - (Horde_Kolab_Storage) [REQUIRED] The storage backend. * 'folder' - (string) The default name of the preferences folder. * DEFAULT: _('Preferences') * </pre> * * @throws InvalidArgumentException */ public function __construct($user, array $params = array()) { if (!isset($params['kolab'])) { throw new InvalidArgumentException('Missing "kolab" parameter.'); } $this->_kolab = $params['kolab']; unset($params['kolab']); if (isset($params['logger'])) { $this->_logger = $params['logger']; } if (isset($params['folder'])) { $this->_folder = $params['folder']; } else { $this->_folder = Horde_Prefs_Translation::t("Preferences"); } parent::__construct($user, $params); }
/** * Constructor. * * @param string $user The username. * @param array $params Configuration parameters. * - 'ldap': (Horde_Ldap) [REQUIRED] The DB instance. * * @throws InvalidArgumentException */ public function __construct($user, array $params = array()) { if (!isset($params['ldap'])) { throw new InvalidArgumentException('Missing ldap parameter.'); } $this->_ldap = $params['ldap']; unset($params['ldap']); try { $this->_prefsDN = $this->_ldap->findUserDN($user); } catch (Horde_Ldap_Exception $e) { throw new Horde_Prefs_Exception($e); } try { // Try do find an existing preference object in an organizational // unit under the userDN $search = $this->_ldap->search($this->_prefsDN, Horde_Ldap_Filter::create('objectclass', 'equals', 'hordePerson'), array('attributes' => array('dn'), 'scope' => 'sub')); if ($search->count() == 1) { $this->_prefsDN = $search->shiftEntry()->currentDN(); } } catch (Horde_Ldap_Exception $e) { } parent::__construct($user, $params); }