fix: workerHoliday hr
gitea/salix/pipeline/pr-master This commit looks good
Details
gitea/salix/pipeline/pr-master This commit looks good
Details
This commit is contained in:
parent
cf862202ff
commit
4e6b83809b
|
@ -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');
|
||||
|
|
|
@ -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({
|
||||
|
|
Loading…
Reference in New Issue