diff --git a/apps/edr-freight-api/src/seed/freight-permissions.registry.ts b/apps/edr-freight-api/src/seed/freight-permissions.registry.ts index aaebbe52a..18554fbb8 100644 --- a/apps/edr-freight-api/src/seed/freight-permissions.registry.ts +++ b/apps/edr-freight-api/src/seed/freight-permissions.registry.ts @@ -662,6 +662,41 @@ export const FREIGHT_PERMS = { const allRuleEngineViewKeys = () => RULE_ENGINE_RESOURCE_SLUGS.map((s) => FREIGHT_PERMS.ruleEngine.view(s)); +/** + * Granular equivalents of the legacy fleet:view + fleet:manage pair. + * Deliberately excludes the wagon-transfer keys — those were always separate + * grants (requester vs OCC vs admin history), not part of fleet:manage. + */ +const FLEET_GRANULAR_KEYS: string[] = [ + FREIGHT_PERMS.locomotives.view, + FREIGHT_PERMS.locomotives.create, + FREIGHT_PERMS.locomotives.update, + FREIGHT_PERMS.locomotives.delete, + FREIGHT_PERMS.wagons.view, + FREIGHT_PERMS.wagons.create, + FREIGHT_PERMS.wagons.update, + FREIGHT_PERMS.wagons.delete, + FREIGHT_PERMS.trains.view, + FREIGHT_PERMS.trains.create, + FREIGHT_PERMS.trains.update, + FREIGHT_PERMS.trains.delete, + FREIGHT_PERMS.trains.assignWagons, + FREIGHT_PERMS.routes.view, + FREIGHT_PERMS.routes.create, + FREIGHT_PERMS.routes.update, + FREIGHT_PERMS.routes.delete, + FREIGHT_PERMS.containers.view, + FREIGHT_PERMS.containers.create, + FREIGHT_PERMS.containers.update, + FREIGHT_PERMS.containers.delete, + FREIGHT_PERMS.cargoes.view, + FREIGHT_PERMS.cargoes.create, + FREIGHT_PERMS.cargoes.update, + FREIGHT_PERMS.cargoes.delete, + FREIGHT_PERMS.consignments.view, + FREIGHT_PERMS.consignments.create, +]; + export const ROLE_PERMISSION_PRESETS = { // Marketing / line staff: drives a booking from intake through line-staff // approval and contract generation/signing — i.e. until the contract is ready @@ -690,6 +725,7 @@ export const ROLE_PERMISSION_PRESETS = { FREIGHT_PERMS.trainScheduling.manage, FREIGHT_PERMS.fleet.view, FREIGHT_PERMS.fleet.manage, + ...FLEET_GRANULAR_KEYS, // Path A (no customs): Operations reviews the customer's self-clearance docs // — on the contract for ONE_TIME contracts, and PER BOOKING for GENERAL // contracts (booking-level document review → finalize → CLEARANCE_READY).