5488-use_checkAccessAcl #1482

Merged
alexm merged 32 commits from 5488-use_checkAccessAcl into dev 2023-05-29 05:20:29 +00:00
6 changed files with 13 additions and 18 deletions
Showing only changes of commit 08fcbebbaf - Show all commits

View File

@ -27,8 +27,7 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `pri
('Supplier', 'editPayMethodCheck', 'WRITE', 'ALLOW', 'ROLE', 'financial'),
('Worker', 'isTeamBoss', 'WRITE', 'ALLOW', 'ROLE', 'teamBoss'),
('Worker', 'forceIsSubordinate', 'READ', 'ALLOW', 'ROLE', 'hr'),
('Claim', 'editState', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
('Claim', 'filter', 'READ', 'ALLOW', 'ROLE', 'employee');
('Claim', 'editState', 'WRITE', 'ALLOW', 'ROLE', 'claimManager');
alexm marked this conversation as resolved Outdated
Outdated
Review

SalesPerson

SalesPerson
DELETE FROM `salix`.`ACL`
Outdated
Review

De aci cap a baix estan els ACLs que he tingut que donar per a que funcione tot despres de llevar els ACLs de
He intententat ficarlos lo mes precis posible per sino ho he vist clar he dixat employee
Si vegeu alguno per a canviar poseumeu pls

De aci cap a baix estan els ACLs que he tingut que donar per a que funcione tot despres de llevar els ACLs de He intententat ficarlos lo mes precis posible per sino ho he vist clar he dixat employee Si vegeu alguno per a canviar poseumeu pls
WHERE
@ -38,15 +37,16 @@ DELETE FROM `salix`.`ACL`
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('Claim', 'find', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Claim', 'findById', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Claim', 'findOne', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Claim', 'getSummary', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Claim', 'updateClaim', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Claim', 'find', 'READ', 'ALLOW', 'ROLE', 'salesPerson'),
('Claim', 'findById', 'READ', 'ALLOW', 'ROLE', 'salesPerson'),
('Claim', 'findOne', 'READ', 'ALLOW', 'ROLE', 'salesPerson'),

Jo en el meu he posat el exists també, no se si cal posarlo ara o esperar a que es gaste

Jo en el meu he posat el exists també, no se si cal posarlo ara o esperar a que es gaste
Outdated
Review

/exists sols he vist q ho gaste el model account i workerDisableExcludeds. Si no es gasta no el donaria de moment

/exists sols he vist q ho gaste el model account i workerDisableExcludeds. Si no es gasta no el donaria de moment
('Claim', 'getSummary', 'READ', 'ALLOW', 'ROLE', 'salesPerson'),
('Claim', 'updateClaim', 'WRITE', 'ALLOW', 'ROLE', 'salesPerson'),
alexm marked this conversation as resolved Outdated
Outdated
Review

SalesPerson

SalesPerson
('Claim', 'regularizeClaim', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
alexm marked this conversation as resolved Outdated
Outdated
Review

SalesPerson

SalesPerson
('Claim', 'updateClaimDestination', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
('Claim', 'downloadFile', 'READ', 'ALLOW', 'ROLE', 'claimManager'),
('Claim', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
('Claim', 'filter', 'READ', 'ALLOW', 'ROLE', 'salesPerson'),
('Claim', 'logs', 'READ', 'ALLOW', 'ROLE', 'claimManager');
DELETE FROM `salix`.`ACL`

View File

@ -17,7 +17,7 @@ describe('Claim summary path', () => {
});
it('should navigate to the target claim summary section', async() => {
await page.loginAndModule('employee', 'claim');
await page.loginAndModule('salesPerson', 'claim');
await page.accessToSearchResult(claimId);
await page.waitForState('claim.card.summary');
});

View File

@ -16,7 +16,7 @@ describe('Claim descriptor path', () => {
});
it('should now navigate to the target claim summary section', async() => {
await page.loginAndModule('employee', 'claim');
await page.loginAndModule('salesPerson', 'claim');
await page.accessToSearchResult(claimId);
await page.waitForState('claim.card.summary');
});

View File

@ -3,6 +3,7 @@ let UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('transferSales', {
description: 'Transfer sales to a new or a given ticket',
accessType: 'WRITE',
accepts: [{
arg: 'id',
type: 'number',

View File

@ -31,15 +31,9 @@ module.exports = Self => {
Object.assign(myOptions, options);
const mySubordinates = await Self.mySubordinates(ctx, myOptions);
const isSubordinate = mySubordinates.find(subordinate => {
return subordinate.workerFk == id;
});
const isSubordinate = mySubordinates.some(subordinate => subordinate.workerFk == id);
const forceIsSubordinate = await models.ACL.checkAccessAcl(ctx, 'Worker', 'forceIsSubordinate', 'READ');
if (forceIsSubordinate || isSubordinate)
return true;
return false;
return forceIsSubordinate || isSubordinate;
};
};

View File

@ -35,7 +35,7 @@ module.exports = Self => {
&& where.agencyModeFk && where.warehouseFk;
if (filterByAvailability) {
const canSeeExpired = await models.ACL.checkAccessAcl(ctx, 'Agency', 'editDiscount');
const canSeeExpired = await models.ACL.checkAccessAcl(ctx, 'Agency', 'seeExpired');
alexm marked this conversation as resolved Outdated

açò es correcte? es diuen distint

açò es correcte? es diuen distint
let showExpired = false;
if (canSeeExpired.length) showExpired = true;