From 475bc2c255d800c5f1455e5df32f9766bf1ec747 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 23 Feb 2023 14:33:16 +0100 Subject: [PATCH] feat: solo puede dar conforme/no confome el propio usuario --- .../worker-time-control/updateWorkerTimeControlMail.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js b/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js index dced6487b..642ff90d2 100644 --- a/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js +++ b/modules/worker/back/methods/worker-time-control/updateWorkerTimeControlMail.js @@ -47,6 +47,10 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); + const isHimself = userId == args.workerId; + if (!isHimself) + throw new UserError(`You don't have enough privileges`); + const workerTimeControlMail = await models.WorkerTimeControlMail.findOne({ where: { workerFk: args.workerId,