feat: refs #6286 check if is teamBoss
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-06-25 17:27:00 +02:00
parent 93f2995d39
commit 1f6fd8d6d1
1 changed files with 3 additions and 1 deletions

View File

@ -35,8 +35,10 @@ module.exports = Self => {
const yearNumber = dated.getFullYear();
const weekNumber = moment(dated).isoWeek();
const isSubordinate = await models.Worker.isSubordinate(ctx, workerId, myOptions);
const isTeamBoss = await models.ACL.checkAccessAcl(ctx, 'Worker', 'isTeamBoss', 'WRITE');
if (!await models.Worker.isSubordinate(ctx, workerId) || workerId === ctx.req.accessToken.userId)
if (!isSubordinate || (workerId === ctx.req.accessToken.userId && !isTeamBoss))
throw new UserError(`You don't have enough privileges`);
const workerTimeControlMail = await models.WorkerTimeControlMail.findOne({