feat: refs #7119 update ACLs for vehicle management and refine vehicle filter logic
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2025-01-20 18:05:33 +01:00
parent 946d08e543
commit 3d2a7cfb66
3 changed files with 21 additions and 20 deletions

View File

@ -1,7 +1,10 @@
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES ('Vehicle', 'filter', 'READ', 'ALLOW', 'ROLE', 'delivery'),
('Vehicle', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'delivery'),
('BankPolicy', 'find', 'READ', 'ALLOW', 'ROLE', 'delivery'),
('VehicleState', 'find', 'READ', 'ALLOW', 'ROLE', 'delivery' ),
('Ppe', 'find', 'READ', 'ALLOW', 'ROLE', 'delivery' ),
('Vehicle', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss');
VALUES ('Vehicle', 'filter', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Vehicle', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Vehicle', 'findById', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Vehicle', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
('BankPolicy', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('VehicleState', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative' ),
('Ppe', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative' ),
('Vehicle', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
('Vehicle', '__get__active', 'READ', 'ALLOW', 'ROLE', 'employee');

View File

@ -94,7 +94,7 @@ module.exports = Self => {
}
}) || {};
const myFilter = mergeFilters(filter, {where: {...where, isActive: true}});
const myFilter = mergeFilters(filter, {where});
const stmt = new ParameterizedSQL(`
SELECT v.id,

View File

@ -104,19 +104,17 @@
"property": "ppeFk"
}
},
"scope": {
"where": {
"isActive": {
"neq": false
"scopes": {
"active": {
"fields": [
"id",
"numberPlate"
],
"where": {
"isActive": {
"neq": false
}
}
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}
}