refs #5753 isNotEditableCredit to zeroCreditEditor
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
ff320895a2
commit
6fcbf69f60
|
@ -4,4 +4,10 @@ UPDATE `salix`.`ACL`
|
||||||
model = 'Client'
|
model = 'Client'
|
||||||
AND property = 'editCredit';
|
AND property = 'editCredit';
|
||||||
|
|
||||||
|
UPDATE `salix`.`ACL`
|
||||||
|
SET property='zeroCreditEditor'
|
||||||
|
WHERE
|
||||||
|
model = 'Client'
|
||||||
|
AND property = 'isNotEditableCredit';
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -413,18 +413,18 @@ module.exports = Self => {
|
||||||
order: 'id DESC'
|
order: 'id DESC'
|
||||||
}, ctx.options);
|
}, ctx.options);
|
||||||
|
|
||||||
if (lastCredit) {
|
if (lastCredit && lastCredit.amount == 0) {
|
||||||
const canEdit =
|
const zeroCreditEditor =
|
||||||
await models.ACL.checkAccessAcl(accessToken, 'Client', 'isNotEditableCredit', 'WRITE');
|
await models.ACL.checkAccessAcl(accessToken, 'Client', 'zeroCreditEditor', 'WRITE');
|
||||||
const lastCreditIsNotEditable =
|
const lastCreditIsNotEditable =
|
||||||
await models.ACL.checkAccessAcl(
|
await models.ACL.checkAccessAcl(
|
||||||
{req: {accessToken: {userId: lastCredit.workerFk}}},
|
{req: {accessToken: {userId: lastCredit.workerFk}}},
|
||||||
'Client',
|
'Client',
|
||||||
'isNotEditableCredit',
|
'zeroCreditEditor',
|
||||||
'WRITE'
|
'WRITE'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (lastCredit.amount == 0 && lastCreditIsNotEditable && !canEdit)
|
if (lastCreditIsNotEditable && !zeroCreditEditor)
|
||||||
throw new UserError(`You can't change the credit set to zero from a financialBoss`);
|
throw new UserError(`You can't change the credit set to zero from a financialBoss`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue