mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
Merge pull request #927 from Tria-plc/freight_feature/usermanagement
implement freight permissions for trains, wagons, and routes
This commit is contained in:
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user