fix: hotfix 7323 createAbsence #3265

Merged
carlossa merged 5 commits from hotfix-7323workerHoliday into master 2024-12-09 12:28:53 +00:00
2 changed files with 3 additions and 3 deletions
Showing only changes of commit 4e6b83809b - Show all commits

View File

@ -1,2 +1,2 @@
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('Worker','isHr','WRITE','ALLOW','ROLE','hr');
VALUES ('Worker','canCreateAbsenceInPast','WRITE','ALLOW','ROLE','hr');

View File

@ -54,7 +54,7 @@ module.exports = Self => {
try {
const isSubordinate = await models.Worker.isSubordinate(ctx, id, myOptions);
const isTeamBoss = await models.ACL.checkAccessAcl(ctx, 'Worker', 'isTeamBoss', 'WRITE');
const isHr = await models.ACL.checkAccessAcl(ctx, 'Worker', 'isHr', 'WRITE');
const canCreateAbsenceInPast = await models.ACL.checkAccessAcl(ctx, 'Worker', 'canCreateAbsenceInPast', 'WRITE');
if (!isSubordinate || (isSubordinate && userId == id && !isTeamBoss))
throw new UserError(`You don't have enough privileges`);
@ -116,7 +116,7 @@ module.exports = Self => {
const newDate = new Date(ctx.args.dated).getTime();
const nowDate = now.getTime();
if ((nowDate > newDate) && !isHr)
if ((nowDate > newDate) && !canCreateAbsenceInPast)
throw new UserError(`Holidays to past days not available`);
const absence = await models.Calendar.create({