converting to MP, just config in accessRights left
This commit is contained in:
+2
-49
@@ -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));
|
||||
},
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user