Exit scene acess denied detected (#1369)

* Add auth token user to get right in admin and check if user have right

Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>

* Update error show

Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
grégoire parant
2021-08-15 08:51:35 +02:00
committed by GitHub
parent f7daf16ac5
commit 02a21209ec
7 changed files with 67 additions and 8 deletions
+8 -1
View File
@@ -5,6 +5,8 @@ import { adminApi } from "../Services/AdminApi";
import { ADMIN_API_URL } from "../Enum/EnvironmentVariable";
import { GameRoomPolicyTypes } from "../Model/PusherRoom";
import { MapDetailsData } from "../Services/AdminApi/MapDetailsData";
import { socketManager } from "../Services/SocketManager";
import { jwtTokenManager } from "../Services/JWTTokenManager";
export class MapController extends BaseController {
constructor(private App: TemplatedApp) {
@@ -67,7 +69,12 @@ export class MapController extends BaseController {
(async () => {
try {
const mapDetails = await adminApi.fetchMapDetails(query.playUri as string);
let userId: string | undefined = undefined;
if (query.authToken != undefined) {
const authTokenData = jwtTokenManager.decodeJWTToken(query.authToken as string);
userId = authTokenData.identifier;
}
const mapDetails = await adminApi.fetchMapDetails(query.playUri as string, userId);
res.writeStatus("200 OK");
this.addCorsHeaders(res);