wulf-pulse/lib
lorentz 00f196c115 fix(auth): stop hasPermission crashing for non-admin ("user") roles
hasPermission()'s parameter was named userRole: string, shadowing the
module-level userRole role object exported earlier in the same file.
The internal roles map's `user: userRole` entry therefore bound to the
shadowed string parameter (e.g. "user") instead of the actual role
object — so any permission check for a "user"-role session (the only
non-admin role in the app) hit `"user".statements[resource]`, which is
undefined, and threw instead of returning false.

Net effect: every requirePermission()-gated route in the app returned
a 500 instead of a 403 for non-admin users. This predates phase 14 —
surfaced now because phase 14's PAX8 resolve route is admin-gated and
got exercised by a non-admin account during verification.

Renamed the parameter to roleName to remove the collision. Added
lib/permissions.test.ts (previously zero coverage on this file) to
lock in the "user"/admin/super-admin behavior and prevent regression.
2026-07-12 18:20:36 -04:00
..
hooks feat(07.1-04): add useUserTimezone client hook 2026-05-07 07:52:16 -04:00
services docs(14-02): drop literal candidate_company_ids mention from resolver docstring 2026-07-11 14:29:43 -04:00
types feat(appgate): add AppGate SDP integration health check and sync service 2026-07-11 09:43:48 -04:00
utils fix(quick-260521-foj-01): widen Companies full sync to fetch all companies 2026-05-21 11:21:48 -04:00
auth-client.ts feat: add authentication, user management, and admin features 2026-01-31 12:43:14 -05:00
auth-utils.ts feat(design): nav/visual overhaul — brand layer, /status route, KPI dashboard, TanStack DataTable 2026-05-03 09:33:13 -04:00
auth.ts feat(09-01): add theme column to user table + Better Auth additionalField 2026-05-10 07:22:26 -04:00
bootstrap.ts fix: "user" table writes use "updatedAt" not updated_at 2026-05-10 23:03:36 -04:00
permissions.test.ts fix(auth): stop hasPermission crashing for non-admin ("user") roles 2026-07-12 18:20:36 -04:00
permissions.ts fix(auth): stop hasPermission crashing for non-admin ("user") roles 2026-07-12 18:20:36 -04:00
status-registry.ts feat(design): nav/visual overhaul — brand layer, /status route, KPI dashboard, TanStack DataTable 2026-05-03 09:33:13 -04:00
utils.ts Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00