5488-use_checkAccessAcl #1482
|
@ -27,8 +27,7 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `pri
|
||||||
('Supplier', 'editPayMethodCheck', 'WRITE', 'ALLOW', 'ROLE', 'financial'),
|
('Supplier', 'editPayMethodCheck', 'WRITE', 'ALLOW', 'ROLE', 'financial'),
|
||||||
('Worker', 'isTeamBoss', 'WRITE', 'ALLOW', 'ROLE', 'teamBoss'),
|
('Worker', 'isTeamBoss', 'WRITE', 'ALLOW', 'ROLE', 'teamBoss'),
|
||||||
('Worker', 'forceIsSubordinate', 'READ', 'ALLOW', 'ROLE', 'hr'),
|
('Worker', 'forceIsSubordinate', 'READ', 'ALLOW', 'ROLE', 'hr'),
|
||||||
('Claim', 'editState', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
|
('Claim', 'editState', 'WRITE', 'ALLOW', 'ROLE', 'claimManager');
|
||||||
('Claim', 'filter', 'READ', 'ALLOW', 'ROLE', 'employee');
|
|
||||||
|
|
||||||
alexm marked this conversation as resolved
Outdated
|
|||||||
DELETE FROM `salix`.`ACL`
|
DELETE FROM `salix`.`ACL`
|
||||||
alexm
commented
De aci cap a baix estan els ACLs que he tingut que donar per a que funcione tot despres de llevar els ACLs de 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
|
WHERE
|
||||||
|
@ -38,15 +37,16 @@ DELETE FROM `salix`.`ACL`
|
||||||
|
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
VALUES
|
VALUES
|
||||||
('Claim', 'find', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
('Claim', 'find', 'READ', 'ALLOW', 'ROLE', 'salesPerson'),
|
||||||
('Claim', 'findById', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
('Claim', 'findById', 'READ', 'ALLOW', 'ROLE', 'salesPerson'),
|
||||||
('Claim', 'findOne', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
('Claim', 'findOne', 'READ', 'ALLOW', 'ROLE', 'salesPerson'),
|
||||||
jgallego
commented
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
alexm
commented
/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', 'employee'),
|
('Claim', 'getSummary', 'READ', 'ALLOW', 'ROLE', 'salesPerson'),
|
||||||
('Claim', 'updateClaim', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
('Claim', 'updateClaim', 'WRITE', 'ALLOW', 'ROLE', 'salesPerson'),
|
||||||
alexm marked this conversation as resolved
Outdated
alexm
commented
SalesPerson SalesPerson
|
|||||||
('Claim', 'regularizeClaim', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
|
('Claim', 'regularizeClaim', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
|
||||||
alexm marked this conversation as resolved
Outdated
alexm
commented
SalesPerson SalesPerson
|
|||||||
('Claim', 'updateClaimDestination', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
|
('Claim', 'updateClaimDestination', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
|
||||||
('Claim', 'downloadFile', 'READ', 'ALLOW', 'ROLE', 'claimManager'),
|
('Claim', 'downloadFile', 'READ', 'ALLOW', 'ROLE', 'claimManager'),
|
||||||
('Claim', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
|
('Claim', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
|
||||||
|
('Claim', 'filter', 'READ', 'ALLOW', 'ROLE', 'salesPerson'),
|
||||||
('Claim', 'logs', 'READ', 'ALLOW', 'ROLE', 'claimManager');
|
('Claim', 'logs', 'READ', 'ALLOW', 'ROLE', 'claimManager');
|
||||||
|
|
||||||
DELETE FROM `salix`.`ACL`
|
DELETE FROM `salix`.`ACL`
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe('Claim summary path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should navigate to the target claim summary section', async() => {
|
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.accessToSearchResult(claimId);
|
||||||
await page.waitForState('claim.card.summary');
|
await page.waitForState('claim.card.summary');
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,7 @@ describe('Claim descriptor path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now navigate to the target claim summary section', async() => {
|
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.accessToSearchResult(claimId);
|
||||||
await page.waitForState('claim.card.summary');
|
await page.waitForState('claim.card.summary');
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,6 +3,7 @@ let UserError = require('vn-loopback/util/user-error');
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('transferSales', {
|
Self.remoteMethodCtx('transferSales', {
|
||||||
description: 'Transfer sales to a new or a given ticket',
|
description: 'Transfer sales to a new or a given ticket',
|
||||||
|
accessType: 'WRITE',
|
||||||
accepts: [{
|
accepts: [{
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
|
|
@ -31,15 +31,9 @@ module.exports = Self => {
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const mySubordinates = await Self.mySubordinates(ctx, myOptions);
|
const mySubordinates = await Self.mySubordinates(ctx, myOptions);
|
||||||
const isSubordinate = mySubordinates.find(subordinate => {
|
const isSubordinate = mySubordinates.some(subordinate => subordinate.workerFk == id);
|
||||||
return subordinate.workerFk == id;
|
|
||||||
});
|
|
||||||
|
|
||||||
const forceIsSubordinate = await models.ACL.checkAccessAcl(ctx, 'Worker', 'forceIsSubordinate', 'READ');
|
const forceIsSubordinate = await models.ACL.checkAccessAcl(ctx, 'Worker', 'forceIsSubordinate', 'READ');
|
||||||
|
|
||||||
if (forceIsSubordinate || isSubordinate)
|
return forceIsSubordinate || isSubordinate;
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
||||||
&& where.agencyModeFk && where.warehouseFk;
|
&& where.agencyModeFk && where.warehouseFk;
|
||||||
|
|
||||||
if (filterByAvailability) {
|
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
jgallego
commented
açò es correcte? es diuen distint açò es correcte? es diuen distint
|
|||||||
let showExpired = false;
|
let showExpired = false;
|
||||||
if (canSeeExpired.length) showExpired = true;
|
if (canSeeExpired.length) showExpired = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
SalesPerson