Commit Graph
5 Commits
Author SHA1 Message Date
admin 706a075d73 fix: use nextUrl.clone() for middleware redirects to preserve basePath /ims 2026-07-12 14:39:01 +08:00
admin c1c874b3fe fix: exclude /api/cron from auth middleware so cron jobs run unauthenticated 2026-07-12 13:59:54 +08:00
admin 3f8da5bd91 feat: incident report form, API route, middleware shared-route + redirect 2026-07-10 13:19:45 +08:00
admin 28957f1e0f fix: patch critical auth and RLS security findings from final review 2026-07-10 06:01:36 +08:00
adminandClaude Sonnet 4.6 6939a21183 feat: add user role types and auth middleware
- lib/auth/roles.ts: UserRole union, ALL_ROLES, ROLE_HOME, getRoleHome, isValidRole (pure, no Supabase imports)
- __tests__/lib/auth/roles.test.ts: 8 TDD tests (written before implementation)
- middleware.ts: createServerClient with request.cookies pattern, unauthenticated redirect to /login, role-based redirect on / and /login

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AWxyMibCuGGtSQSqfajDQ7
2026-07-09 21:39:32 +08:00