Merge pull request #18543 from lainwir3d/fix_restapi_global_user_variable

FIX #18542 REST API: set global $user variable to DolibarrApiAccess::user
This commit is contained in:
Laurent Destailleur 2021-09-01 18:05:40 +02:00 committed by GitHub
commit 7e8ce82e0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,7 +80,7 @@ class DolibarrApiAccess implements iAuthenticate
public function __isAllowed()
{
// phpcs:enable
global $conf, $db;
global $conf, $db, $user;
$login = '';
$stored_key = '';
@ -149,6 +149,9 @@ class DolibarrApiAccess implements iAuthenticate
}
$fuser->getrights();
static::$user = $fuser;
// Set the global variable $user to the $user of API
$user = $fuser;
if ($fuser->socid) {
static::$role = 'external';