Merge branch 'ent-7621-autenticacion-local-usuarios-solo-api' into 'develop'

Fix api local auth

See merge request artica/pandorafms!4258
This commit is contained in:
Daniel Rodriguez 2022-04-19 12:21:36 +00:00
commit be24fd7b28
2 changed files with 29 additions and 16 deletions

View File

@ -101,18 +101,30 @@ function process_user_login($login, $pass, $api=false)
}
// 2. Try local.
if ($login_remote === false
&& ($config['fallback_local_auth']
if ($login_remote === false) {
if ($api === true) {
$user_not_login = db_get_value(
'not_login',
'tusuario',
'id_user',
$login
);
}
if ($config['fallback_local_auth']
|| is_user_admin($login)
|| $local_user === true
|| strtolower($config['auth']) == 'mysql')
|| strtolower($config['auth']) == 'mysql'
|| (bool) $user_not_login === true
) {
return process_user_login_local($login, $pass, $api);
} else {
return false;
}
} else {
return $login_remote;
}
return false;
}

View File

@ -10,16 +10,15 @@ namespace UpdateManager;
require_once __DIR__.'/../vendor/autoload.php';
// Load Config class from updatemanager project to read test.ini settings.
// Embeebed mode.
@include_once __DIR__.'/../../src/lib/Config.php';
@include_once __DIR__.'/../../src/lib/License.php';
@include_once __DIR__.'/../../src/lib/DB.php';
@require_once __DIR__.'/../../src/lib/Config.php';
@require_once __DIR__.'/../../src/lib/License.php';
@require_once __DIR__.'/../../src/lib/DB.php';
// Referenced mode.
@include_once __DIR__.'/../../updatemanager/src/lib/Config.php';
@include_once __DIR__.'/../../updatemanager/src/lib/License.php';
@include_once __DIR__.'/../../updatemanager/src/lib/DB.php';
@require_once __DIR__.'/../../updatemanager/src/lib/Config.php';
@require_once __DIR__.'/../../updatemanager/src/lib/License.php';
@require_once __DIR__.'/../../updatemanager/src/lib/DB.php';
/**
* Test the Client class.
@ -562,4 +561,6 @@ class ClientTest extends \PHPUnit\Framework\TestCase
// Cleanup.
$umc_enterprise->getDBH()->query('DROP DATABASE `ent`');
}
}