fix: prevent deleting absences for past dates
gitea/salix/pipeline/pr-master There was a failure building this commit
Details
gitea/salix/pipeline/pr-master There was a failure building this commit
Details
This commit is contained in:
parent
60933216f7
commit
c07e30a89c
|
@ -0,0 +1,2 @@
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Worker','canDeleteAbsenceInPast','WRITE','ALLOW','ROLE','hr');
|
|
@ -53,6 +53,12 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
const canDeleteAbsenceInPast =
|
||||||
|
await models.ACL.checkAccessAcl(ctx, 'Worker', 'canDeleteAbsenceInPast', 'WRITE');
|
||||||
|
|
||||||
|
if (!canDeleteAbsenceInPast && Date.vnNow() > absence.dated.getTime())
|
||||||
|
throw new UserError(`Holidays to past days not available`);
|
||||||
|
|
||||||
const result = await absence.destroy(myOptions);
|
const result = await absence.destroy(myOptions);
|
||||||
const labour = absence.labour();
|
const labour = absence.labour();
|
||||||
const department = labour && labour.department();
|
const department = labour && labour.department();
|
||||||
|
|
Loading…
Reference in New Issue