function __construct($params) { if (!extension_loaded('ldap')) { throw new jException('jelix~auth.ldap.extension.unloaded'); } parent::__construct($params); // default ldap parameters $_default_params = array('hostname' => 'localhost', 'port' => 389, 'ldapUser' => null, 'ldapPassword' => null, 'protocolVersion' => 3, 'uidProperty' => 'cn'); // iterate each default parameter and apply it to actual params if missing in $params. foreach ($_default_params as $name => $value) { if (!isset($this->_params[$name]) || $this->_params[$name] == '') { $this->_params[$name] = $value; } } if (!isset($this->_params['searchBaseDN']) || $this->_params['searchBaseDN'] == '') { throw new jException('jelix~auth.ldap.search.base.missing'); } if (!isset($this->_params['searchFilter']) || $this->_params['searchFilter'] == '') { throw new jException('jelix~auth.ldap.search.filter.missing'); } if (!isset($this->_params['searchAttributes']) || $this->_params['searchAttributes'] == '') { $this->_params['searchAttributes'] = $this->_default_attributes; } else { $this->_params['searchAttributes'] = explode(",", $this->_params['searchAttributes']); } }
function __construct($params) { parent::__construct($params); if (!isset($this->_params['profile'])) { if (isset($this->_params['profil'])) { $this->_params['profile'] = $this->_params['profil']; } else { $this->_params['profile'] = ''; } } }
function __construct($params) { parent::__construct($params); if (!isset($this->_params['profile'])) { if (isset($this->_params['profil'])) { //compatibility with 1.0 $this->_params['profile'] = $this->_params['profil']; } else { $this->_params['profile'] = ''; } } }
function __construct($params) { if (!extension_loaded('ldap')) { throw new jException('ldapdao~errors.extension.unloaded'); } parent::__construct($params); // default ldap parameters $_default_params = array('hostname' => 'localhost', 'port' => 389, 'ldapAdminUserDn' => null, 'ldapAdminPassword' => null, 'protocolVersion' => 3, 'uidProperty' => 'cn', 'searchUserListReturnsUser' => 1, 'searchUserListUserUidAttribute' => ''); // iterate each default parameter and apply it to actual params if missing in $params. foreach ($_default_params as $name => $value) { if (!isset($this->_params[$name]) || $this->_params[$name] == '') { $this->_params[$name] = $value; } } if (!isset($this->_params['searchBaseDN']) || $this->_params['searchBaseDN'] == '') { throw new jException('ldapdao~errors.search.base.missing'); } if (!isset($this->_params['searchUserListFilter']) || $this->_params['searchUserListFilter'] == '') { throw new jException('ldapdao~errors.search.filter.missing'); } if (!isset($this->_params['searchAttributes']) || $this->_params['searchAttributes'] == '') { $this->_params['searchAttributes'] = $this->_default_attributes; } else { $attrs = explode(",", $this->_params['searchAttributes']); $this->_params['searchAttributes'] = array(); foreach ($attrs as $attr) { if (strpos($attr, ':') === false) { $attr = trim($attr); $this->_params['searchAttributes'][$attr] = $attr; } else { $attr = explode(':', $attr); $this->_params['searchAttributes'][trim($attr[0])] = trim($attr[1]); } } } if (!isset($this->_params['bindUserDN']) || $this->_params['bindUserDN'] == '') { throw new jException('ldapdao~errors.bindUserDN.missing'); } }