roles into wsscnx from sess

This commit is contained in:
STEINNI
2025-09-21 20:09:42 +00:00
parent e7dcb7290e
commit 5d223c776c
5 changed files with 26 additions and 51 deletions
+7 -1
View File
@@ -30,7 +30,7 @@ export class wssServer {
newWSSConnexion(socket, req) {
var uuid = crypto.randomUUID();
if(socket.session && socket.session.authenticated && socket.session.userInfos && socket.session.userInfos.username){
if(socket.session && socket.session.authenticated && socket.session.userInfos && socket.session.userInfos.identity && socket.session.userInfos.identity.username){
var wssCnx = new WssConnexion({
socket: socket,
req, req,
@@ -40,8 +40,14 @@ export class wssServer {
config: this.wssGatewayConfig,
rediscnx: this.REDIScnx,
accessRights: this.accessRights,
userId: socket.session.userInfos.identity.uuid,
roles: socket.session.userInfos.roles,
});
this.AllWssConnections[uuid] = wssCnx;
if(!(wssCnx.userId in this.Users2uuids)) this.Users2uuids[wssCnx.userId] = new Set();
this.Users2uuids[wssCnx.userId].add(uuid);
this.OnlineUsers.add(wssCnx.userId);
this.REDIScnx.wssConnections[uuid] = wssCnx;
this.postLoginActions(wssCnx)
} else socket.close()