Files
edr-platform/apps/edr-freight-api/src/modules
Nathnael 01ea05f013 fix(auth): keep secondary positions in permission checks
IAM lets an employee hold several positions, but the vendored JwtGuard
collapses employee.positions[] down to a single employee.position and
drops the rest. Non-delegate secondary positions vanished entirely, so
staff on two posts resolved to one post's permissions and every check
on the other rejected them.

FreightJwtGuard re-attaches the full list from the same session
snapshot the parent guard already read, so nothing extra is fetched
per request beyond a cached session lookup. employee.position is left
untouched, keeping audit logging and delegation unaffected.
collectPermissionKeys and collectPositionTypeKeys now union across
every position, and /me returns them all.

Verified against a real two-position user (djibouti-gl-director +
djibouti-gl-chief) on the local dev database:

  /me positions                     1   -> 2
  /me permissionKeys                17  -> 28
  GET /api/interchange-documents    403 -> 200
  GET /api/trains                   403 -> 200

11 permissions recovered, none lost. Six single-position users return
byte-identical payloads before and after.
2026-08-25 12:00:43 +00:00
..
2026-08-24 12:24:23 +00:00
2026-08-21 09:25:21 +00:00
2026-08-24 12:24:23 +00:00
2026-08-12 07:12:04 +00:00
2026-08-20 10:29:58 +00:00
fix
2026-07-03 15:21:23 +00:00
2026-07-16 00:33:31 +00:00
2026-08-13 18:56:52 +00:00
2026-08-15 08:10:47 +00:00
2026-08-15 08:10:47 +00:00
2026-08-24 12:24:23 +00:00
2026-07-16 00:33:31 +00:00
2026-08-24 12:24:23 +00:00
2026-08-02 20:29:09 +00:00
2026-08-09 13:27:05 +00:00
2026-07-16 00:33:31 +00:00
2026-07-25 06:05:20 +00:00