converting to MP, just config in accessRights left

This commit is contained in:
STEINNI
2025-10-05 21:24:10 +00:00
parent 03af111d7f
commit 350d37e465
13 changed files with 283 additions and 796 deletions
+2 -49
View File
@@ -37,7 +37,7 @@ export const methods = {
'action': action,
'payload': {
wssGatewayTime: tmstp,
redisTime: this.rediscnx.redisClient.time()
redisTime: this.allRediscnx.map(cnx => cnx.redisClient.time())
},
'success': true,
};
@@ -145,59 +145,12 @@ export const methods = {
var reply = {
'action': action,
'success': true,
'payload': this.rediscnx.getProcessInfo
'payload': this.allRediscnx.map(cnx => cnx.getProcessInfo)
};
if(reqid) reply.reqid = reqid;
this.send(JSON.stringify(reply));
},
action_REDPILL(action, payload, reqid){
if(!this.accessRights.canDo(this.roles, 'REDPILL', this.userId)) {
this.sendErr(action, 'Unauthorized action', reqid);
return;
};
if(!this.rediscnx.redPillsUuids.includes(this.uuid)) {
this.rediscnx.redPillsUuids.push(this.uuid)
setTimeout(() => {
if(this.rediscnx.redPillsUuids.includes(this.uuid)){ // could have been removed meanwhile & splice(-1) would remove the last !!!
this.rediscnx.redPillsUuids.splice(this.rediscnx.redPillsUuids.indexOf(this.uuid),1)
}
let reply = {
'action': 'BLUEPILL',
'payload': {},
'success': true,
};
this.send(JSON.stringify(reply));
}, 600000) // Back to blupill after 10min
}
let reply = {
'action': action,
'payload': {},
'success': true,
};
if(reqid) reply.reqid = reqid;
this.send(JSON.stringify(reply));
},
action_BLUEPILL(action, payload, reqid){
if(!this.accessRights.canDo(this.roles, 'BLUEPILL', this.userId)) {
this.sendErr(action, 'Unauthorized action', reqid);
return;
};
if(this.rediscnx.redPillsUuids.includes(this.uuid)) {
this.rediscnx.redPillsUuids.splice(this.rediscnx.redPillsUuids.indexOf(this.uuid),1)
}
let reply = {
'action': action,
'payload': {},
'success': true,
};
if(reqid) reply.reqid = reqid;
this.send(JSON.stringify(reply));
},
}