This commit is contained in:
Julio Cesar Laura Avendaño
2019-08-28 15:08:18 -04:00
committed by Paula Quispe
parent 39b9939d45
commit d53422eba4
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;
}