Merged in feature/PMC-1158 (pull request #7089)

PMC-721 PMCORE-1015

Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
Paula Quispe
2020-01-17 12:25:49 +00:00
committed by Julio Cesar Laura Avendaño
2 changed files with 20 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ namespace ProcessMaker\Services\OAuth2;
use Luracast\Restler\iAuthenticate;
use Luracast\Restler\RestException;
use OAuth2\Request;
/*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLog;
/*----------------------------------********---------------------------------*/
@@ -411,6 +412,19 @@ class Server implements iAuthenticate
public static function getUserId()
{
// If is empty, get the User Uid using the current request
if (empty(self::$userId) && !empty(self::$dsn)) {
// Get current request object
$request = Request::createFromGlobals();
// Get token data
$serverInstance = new Server();
$server = $serverInstance->getServer();
$tokenData = $server->getAccessTokenData($request);
// Set the User Uid
self::$userId = $tokenData['user_id'];
}
return self::$userId;
}