fix: refs #7917 fix getRouteByAgency
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Carlos Satorres 2024-12-02 11:52:33 +01:00
parent ed8be4333f
commit 634e496ef0
2 changed files with 4 additions and 2 deletions

View File

@ -2,5 +2,6 @@ INSERT INTO salix.ACL (model, property, accessType, permission, principalType, p
VALUES VALUES
('Route', 'getTickets', 'READ', 'ALLOW', 'ROLE', 'delivery'), ('Route', 'getTickets', 'READ', 'ALLOW', 'ROLE', 'delivery'),
('AgencyTerm', 'filter', 'READ', 'ALLOW', 'ROLE', 'delivery'), ('AgencyTerm', 'filter', 'READ', 'ALLOW', 'ROLE', 'delivery'),
('Route', 'summary', 'READ', 'ALLOW', 'ROLE', 'delivery'); ('Route', 'summary', 'READ', 'ALLOW', 'ROLE', 'delivery'),
('AgencyTerm', 'getRouteByAgency', 'READ', 'ALLOW', 'ROLE', 'delivery');

View File

@ -73,9 +73,10 @@ module.exports = Self => {
}); });
filter = mergeFilters(ctx.args?.filter ?? {}, {where}); filter = mergeFilters(ctx.args?.filter ?? {}, {where});
const getRouteByAgency = await models.ACL.checkAccessAcl(ctx, 'Route', 'getRouteByAgency', 'WRITE');
const supplier = await Self.app.models.Supplier.isSupplier(ctx, myOptions); const supplier = await Self.app.models.Supplier.isSupplier(ctx, myOptions);
if (supplier) { if (supplier && getRouteByAgency) {
if (!filter.where) filter.where = {}; if (!filter.where) filter.where = {};
filter.where[`a.supplierFk`] = supplier.id; filter.where[`a.supplierFk`] = supplier.id;
} }