Circuit go on...

This commit is contained in:
paoloar77
2022-08-30 17:00:48 +02:00
parent a2019c6ac9
commit f55d69b7fe
7 changed files with 275 additions and 16 deletions

View File

@@ -711,6 +711,34 @@ router.post('/groups/cmd', authenticate, (req, res) => {
});
router.post('/circuits/cmd', authenticate, (req, res) => {
const usernameLogged = req.user.username;
const idapp = req.body.idapp;
const locale = req.body.locale;
const usernameOrig = req.body.usernameOrig;
const name = req.body.name;
const cmd = req.body.cmd;
const value = req.body.value;
/*if (!User.isAdmin(req.user.perm) || !User.isManager(req.user.perm)) {
// If without permissions, exit
if (usernameOrig !== usernameLogged) {
return res.status(404).
send({code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: ''});
}
}*/
return User.setCircuitCmd(idapp, usernameOrig, name, cmd, value, usernameLogged).
then((ris) => {
res.send(ris);
}).
catch((e) => {
tools.mylog('ERRORE IN groups/cmd: ' + e.message);
res.status(400).send();
});
});
async function eseguiDbOp(idapp, mydata, locale) {
let ris = await User.DbOp(idapp, mydata);