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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user