fix(eims): keep EIMS filing off the Finance role preset

Invoices are produced by the freight workflow, not by a person, so filing is
not a Finance job function. The manual endpoints exist for controlled testing
and exceptional operations, and are left out of every role preset so they are
assigned to named admins instead.

Split resolve onto its own permission, invoices:eims_resolve: resolving an
unacknowledged submission clears the system-wide chain block and can record an
IRN against an invoice, which is a supervisor action rather than an
operational one. eims/status stays on the ordinary invoices:view.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Hagernesh
2026-08-07 14:42:24 +00:00
parent 2e7ef40d9e
commit 02db3d2e73
2 changed files with 24 additions and 3 deletions

View File

@@ -474,6 +474,14 @@ export const FINANCE_PERMISSIONS: FreightPermissionSeed[] = [
"edr_freight_app:invoices:eims_register",
"Register invoice with MoR EIMS",
),
// Separate from registering: resolving an unacknowledged submission clears the
// system-wide chain block and can record an IRN against an invoice, so it is a
// supervisor/admin action rather than an operational one.
perm(
"d2b00001-0001-4000-8000-000000000006",
"edr_freight_app:invoices:eims_resolve",
"Resolve a blocked MoR EIMS submission",
),
];
// E. First / last mile operations
@@ -1599,6 +1607,7 @@ export const FREIGHT_PERMS = {
view: "edr_freight_app:invoices:view",
export: "edr_freight_app:invoices:export",
eimsRegister: "edr_freight_app:invoices:eims_register",
eimsResolve: "edr_freight_app:invoices:eims_resolve",
},
firstMile: {
view: "edr_freight_app:first_mile:view",
@@ -2088,6 +2097,10 @@ export const ROLE_PERMISSION_PRESETS = {
FREIGHT_PERMS.bookings.view,
FREIGHT_PERMS.invoices.view,
FREIGHT_PERMS.invoices.export,
// Deliberately NOT granted here: invoices:eims_register and invoices:eims_resolve.
// Invoices are filed with MoR by the workflow, not by a person, so filing is not a
// Finance job function — the endpoints exist for controlled testing and exceptional
// operations, and are assigned to named admins rather than a role preset.
FREIGHT_PERMS.payments.view,
FREIGHT_PERMS.bookings.wagonCancellationView,
],