Files
P42_godDaemons/SimMaestro/actions/system/utilities.js
T
2026-06-13 13:47:46 +00:00

49 lines
1.3 KiB
JavaScript

import { publishActionReply } from '../../actionsHelper.js'
export const construct = (redisCnx) => {
}
export const methods = {
async action_RELOADCONFIG(action, payload, reqid, sender, roles) {
const replyOpts = {
action,
reqid,
sender,
replyChannel: this.config.maestro.maestroActionsReply,
}
if(!this.accessRights.canDo(roles, action)) {
publishActionReply(this, { ...replyOpts, reply: {
success: false,
err: 'Unauthorized action !',
} })
return
}
this.reloadAccessRights()
publishActionReply(this, { ...replyOpts, reply: {
success: true,
} })
},
async action_GETCONFIG(action, payload, reqid, sender, roles) {
const replyOpts = {
action,
reqid,
sender,
replyChannel: this.config.maestro.maestroActionsReply,
}
if(!this.accessRights.canDo(roles, action)) {
publishActionReply(this, { ...replyOpts, reply: {
success: false,
err: 'Unauthorized action !',
} })
return
}
publishActionReply(this, { ...replyOpts, reply: {
success: true,
payload: this.getAccessRights(),
} })
},
}