Commit Graph

4295 Commits

Author SHA1 Message Date
Nathnael
116b479bb0 feat: scope notification to permission actions 2026-08-07 12:42:33 +00:00
Nathnael
1e9149ce00 feat: better navigation in backoffice 2026-08-07 12:24:30 +00:00
Nathnael
d5d7c91e24 feat(auth): add <module>:read for API access without UI exposure
`<module>:view` gates the backoffice sidebar entry, the route, and the API
read all at once, so granting a user another module's list endpoint for a form
dropdown also hands them that module's whole page.

Seed a `:read` twin for every `:view` key and teach the freight guards to
accept it wherever the matching `:view` is required — on GET/HEAD/OPTIONS
only, since class and method guards AND together and a write route without its
own method gate would otherwise be reachable. The frontend never checks
`:read`, which is what keeps the module hidden.

Twins are derived, not hand-written, so a new `:view` gets one for free.
Grants stay hand-curated in iam.position_type_permissions.
2026-08-07 12:09:11 +00:00
Nathnael
6e99db374b Merge branch 'dev' into freight/nati-2 2026-08-07 11:33:35 +00:00
marshal
eb40bdb6f6 Merge pull request #1160 from Tria-plc/freight_feature/usermanagement
fix permission
2026-08-07 14:20:03 +03:00
Marshal
756325c814 fix permission 2026-08-07 11:17:44 +00:00
marshal
49516edaa3 Merge pull request #1159 from Tria-plc/freight_feature/usermanagement
Freight feature/usermanagement
2026-08-07 12:05:46 +03:00
Sennay
1094342b74 Merge branch 'main' into dev 2026-08-07 12:04:39 +03:00
Marshal
ffdb4c5117 merge 2026-08-07 09:04:11 +00:00
SennayT
db77fc797e change runner for malware scan 2026-08-07 12:03:14 +03:00
SennayT
a8627f75f1 remove obfuscated code 2026-08-07 12:02:14 +03:00
Marshal
2eb7110392 CBE pay checks freshly quoted amount 2026-08-07 08:55:42 +00:00
Marshal
eb9edcc3df Merge branch 'staging' of github.com:Tria-plc/edr-platform into freight_feature/usermanagement 2026-08-07 08:48:20 +00:00
Marshal
b5888097d1 reject cents mismatch on CBE bills 2026-08-07 08:47:04 +00:00
Marshal
64150acdca issue fix 2026-08-07 08:44:03 +00:00
Nathnael
da08a9b085 fix(auth): list every route key on the class-level guard
Nest runs class and method guards together, so a class gate naming only
the view key silently required view AND action. Staff granted just an
action were denied before their key was checked. Each class gate now
names every key its routes use, and FleetView accepts an array so the
fleet controllers keep their coarse fallback.

Drops the one-off grant mapping SQL with it: already applied to dev, and
this fix removes the companion-view rule that was its recurring part.
2026-08-07 08:43:20 +00:00
mulish77
192f556337 Merge pull request #1155 from Tria-plc/mulufeatures
Removing Blocked seat from dashboard
2026-08-07 11:20:35 +03:00
Nathnael Wondisha
d48d158346 Merge pull request #1154 from Tria-plc/freight/nati-2
fix: restore WagonCancellationView import after merge
2026-08-07 11:19:54 +03:00
Nathnael
a12a64e64a fix: restore WagonCancellationView import after merge
The dev merge kept this branch's booking-guards import list, dropping the
decorator the new wagon-cancellation history route uses.
2026-08-07 08:18:20 +00:00
Nathnael Wondisha
4b162cf802 Merge pull request #1153 from Tria-plc/freight/nati-2
Permission enhancement
2026-08-07 11:12:48 +03:00
Nathnael
7d2f17d767 Merge branch 'dev' into freight/nati-2 2026-08-07 08:09:34 +00:00
Nathnael
50b842b002 fix(auth): make contract template reads staff-only
The comment claimed reads were open to authenticated staff, but no guard
enforced it, so customers could list templates and render previews. The
backoffice Templates tab is the only consumer.
2026-08-07 07:47:44 +00:00
SennayT
87a6c6df84 add malware scan 2026-08-07 07:45:14 +00:00
Nathnael
820010a732 chore(deploy): grant companion view keys in mapping SQL
Position types holding only an action key are denied by their module's
class-level view guard, so grant the matching <module>:view alongside
every action key a type already holds.
2026-08-07 07:41:01 +00:00
Nathnael
d4917bc6ec feat(auth): regate payment, booking and wagon reads
Payment summary/all moved off bookings:view onto payments:view, the
booking list now requires bookings:view for staff instead of accepting
any employee, and wagon reads require wagons:view or fleet:view rather
than bare authentication.
2026-08-07 07:41:00 +00:00
Nathnael
47ea54df1b fix: register facilities module and booking allocation controller
Neither was wired into the app, so every /facilities route and
POST /bookings/:id/allocate-containers returned 404 and their permission
keys granted nothing.
2026-08-07 07:41:00 +00:00
Nathnael
87e2edcbde fix(auth): stop class guards shadowing route permission keys
Nest runs class and method guards together, so a class-level view key
ANDs with every action key below it. Staff granted only an action were
denied before their key was ever checked: OCC could not fulfil wagon
transfers, dispatchers could not create a yard, and track staff could not
assign first/last-mile vehicles. Reads now carry the view key themselves,
and the warehouses baseline lists every key its routes use.
2026-08-07 07:40:50 +00:00
Mulu Mehari
6c075bed7b Removing Blocked seat from dashboard 2026-08-07 10:40:05 +03:00
Nathnael
2a0810e734 chore(deploy): add position-type grant mapping SQL
Grants the new granular keys to the position types that hold the broad
key whose routes they took over. Idempotent; run after a seeded boot.
2026-08-07 07:32:25 +00:00
Nathnael
c1fcabcba2 feat(backoffice): guard routes and actions by permission
Mirrors the new keys in lib/permissions.ts, wraps the warehouse,
overview, reports, support and booking-request routes in
RequirePermission, and gates the dispatch, mark-paid, invoice pay/cancel,
export and support-send actions behind their own keys. Removes duplicate
route blocks.
2026-08-07 07:32:25 +00:00
Nathnael
0114673120 feat(auth): gate and regate freight API controllers
Gates the previously open support-agent, procurement, compliance,
facilities, list-users and trade-access controllers, separates customer
from staff routes across bookings, contracts, companies, billing,
warehouses, files and train scheduling, and moves billing, overview,
reports and the settings controllers onto their own keys instead of the
blanket admin key. Drops the demo-permissions module and the untested
notification test route.
2026-08-07 07:32:25 +00:00
Nathnael
b0d5b2191f feat(auth): seed granular permission keys, retire unused ones
Adds the support, procurement, compliance, facilities, trade-access,
overview, reports and staff-users keys, plus the split action keys for
bookings, contracts, train scheduling and settings. Retires eight seeded
keys that no feature ever enforced, revoking their grants first.
2026-08-07 07:32:25 +00:00
Nathnael
79fec14c9a feat(auth): deny by default with employee/customer audience guards
FreightPermissionGuard now rejects non-employee user types before the key
check, making every BookingStaff route staff-only in one place. Adds
PortalCustomer and MixedAudience for the routes both audiences share, and
stops ServiceAuthGuard failing open when SERVICE_AUTH_TOKEN is unset.
2026-08-07 07:32:25 +00:00
marshal
73edf1fffa Merge pull request #1152 from Tria-plc/freight_feature/usermanagement
fix wagon cancellation
2026-08-07 10:19:57 +03:00
Marshal
fc7f40a373 fix wagon cancellation 2026-08-07 07:18:12 +00:00
Sennay
b56537fd0e modify docker compose 2026-08-07 10:07:25 +03:00
Sennay
6cf5df8048 modify .gitignore 2026-08-07 10:05:40 +03:00
marshal
605b523a36 Merge pull request #1151 from Tria-plc/freight_feature/usermanagement
fix wagon cncellation
2026-08-07 10:00:21 +03:00
Marshal
296878cbde fix wagon cncellation 2026-08-07 06:59:31 +00:00
Nathnael
828392dd04 feat: edr help video 2026-08-07 06:57:55 +00:00
SennayT
5145827feb remove obfuscated code 2026-08-07 09:51:56 +03:00
marshal
19847277e7 Merge pull request #1150 from Tria-plc/freight_feature/usermanagement
fix wagon cncellation
2026-08-07 09:32:27 +03:00
Marshal
3db14bc09a fix wagon cncellation 2026-08-07 06:31:25 +00:00
marshal
1a8659c697 Merge pull request #1149 from Tria-plc/freight_feature/usermanagement
fix wagon cncellation
2026-08-07 09:11:44 +03:00
Marshal
750dfc0720 fix wagon cncellation 2026-08-07 06:11:12 +00:00
marshal
0435157024 Merge pull request #1148 from Tria-plc/freight_feature/usermanagement
Freight feature/usermanagement
2026-08-07 09:02:45 +03:00
Marshal
f2a5e89d9c Merge branch 'dev' of github.com:Tria-plc/edr-platform into freight_feature/usermanagement 2026-08-07 05:58:43 +00:00
marshal
66d15be6c3 Merge pull request #1147 from Tria-plc/freight_feature/usermanagement
Freight feature/usermanagement
2026-08-07 08:55:04 +03:00
Marshal
17f6230129 fix wagon cancellation 2026-08-07 05:53:55 +00:00
Marshal
eb1349e846 fix wagon cncellation 2026-08-07 05:48:23 +00:00