Fixed LDAP authentication + unified app config options: authenticate_settings, security and ldap

This commit is contained in:
Dmitry Khomutov 2017-01-22 18:05:24 +07:00
commit f3bdeb2493
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
17 changed files with 105 additions and 245 deletions

View file

@ -158,13 +158,13 @@ class Application extends b8\Application
*/
protected function shouldSkipAuth()
{
$config = b8\Config::getInstance();
$state = (bool)$config->get('php-censor.authentication_settings.state', false);
$userId = $config->get('php-censor.authentication_settings.user_id', 0);
$config = b8\Config::getInstance();
$disableAuth = (bool)$config->get('php-censor.security.disable_auth', false);
$defaultUserId = (integer)$config->get('php-censor.security.default_user_id', 1);
if (false !== $state && 0 != (int)$userId) {
if ($disableAuth && $defaultUserId) {
$user = b8\Store\Factory::getStore('User')
->getByPrimaryKey($userId);
->getByPrimaryKey($defaultUserId);
if ($user) {
$_SESSION['php-censor-user'] = $user;