Merge branch 'develop' into player-report

# Conflicts:
#	front/src/Connexion/RoomConnection.ts
This commit is contained in:
Gregoire Parant 2020-10-14 15:06:10 +02:00
commit 4799460064
11 changed files with 56 additions and 20 deletions

View file

@ -148,12 +148,14 @@ export class IoSocketController {
const userUuid = await jwtTokenManager.getUserUuidFromToken(token);
console.log('uuid', userUuid);
let memberTags: string[] = [];
if (roomIdentifier.anonymous === false) {
const isGranted = await adminApi.memberIsGrantedAccessToRoom(userUuid, roomIdentifier);
if (!isGranted) {
const grants = await adminApi.memberIsGrantedAccessToRoom(userUuid, roomIdentifier);
if (!grants.granted) {
console.log('access not granted for user '+userUuid+' and room '+roomId);
throw new Error('Client cannot acces this ressource.')
} else {
memberTags = grants.memberTags;
console.log('access granted for user '+userUuid+' and room '+roomId);
}
}
@ -184,7 +186,8 @@ export class IoSocketController {
right,
bottom,
left
}
},
tags: memberTags
},
/* Spell these correctly */
websocketKey,
@ -221,6 +224,7 @@ export class IoSocketController {
client.name = ws.name;
client.characterLayers = ws.characterLayers;
client.roomId = ws.roomId;
client.tags = ws.tags;
this.sockets.set(client.userId, client);
@ -358,6 +362,7 @@ export class IoSocketController {
}
roomJoinedMessage.setCurrentuserid(client.userId);
roomJoinedMessage.setTagList(client.tags);
const serverToClientMessage = new ServerToClientMessage();
serverToClientMessage.setRoomjoinedmessage(roomJoinedMessage);