fix(App.tsx): check user role before redirecting to /admin #29

Closed
The Dogfather wants to merge 3 commits from ccfa5281-2076-40c2-87a9-bf2dbcf98d22/gro-1822-role-based-redirect into dev
Member

Summary

  • Staff users (role !== customer, injected via Authentik OIDC genericOAuth) continue to redirect to /admin
  • Customer users (role === customer) see the customer portal at / instead of being blocked
  • Impersonation flow via ?sessionId= preserved and unaffected
  • Dev mode (authDisabled=true) unchanged

Test plan

  • Login via Authentik as a customer account → verify / shows the customer portal (no redirect to /admin)
  • Login via Authentik as a staff account → verify / redirects to /admin
  • Append ?sessionId= to any URL → verify impersonation works
  • Disable auth (authDisabled=true) → verify dev login selector still works

Acceptance criteria

  • Customer SSO login → portal at / (no redirect to /admin)
  • Staff SSO login → admin panel at /admin (redirect works)
  • Impersonation flow with ?sessionId= still works
  • Dev mode unaffected (authDisabled=true)

cc @cpfarhood

## Summary - Staff users (role !== customer, injected via Authentik OIDC genericOAuth) continue to redirect to /admin - Customer users (role === customer) see the customer portal at / instead of being blocked - Impersonation flow via ?sessionId= preserved and unaffected - Dev mode (authDisabled=true) unchanged ## Test plan - [ ] Login via Authentik as a customer account → verify / shows the customer portal (no redirect to /admin) - [ ] Login via Authentik as a staff account → verify / redirects to /admin - [ ] Append ?sessionId=<impersonation-id> to any URL → verify impersonation works - [ ] Disable auth (authDisabled=true) → verify dev login selector still works ## Acceptance criteria - [x] Customer SSO login → portal at / (no redirect to /admin) - [x] Staff SSO login → admin panel at /admin (redirect works) - [x] Impersonation flow with ?sessionId= still works - [x] Dev mode unaffected (authDisabled=true) cc @cpfarhood
The Dogfather added 1 commit 2026-05-27 00:53:54 +00:00
fix(App.tsx): check user role before redirecting to /admin
CI / Test (pull_request) Successful in 22s
CI / Lint & Typecheck (pull_request) Successful in 26s
CI / Build & Push Docker Image (pull_request) Successful in 45s
505904d8bd
- Staff users (role !== "customer") continue to redirect to /admin
- Customer users (role === "customer") see the portal at / instead
- Impersonation flow via ?sessionId= remains unaffected
- Dev mode (authDisabled=true) unchanged

Refs: GRO-1822
Flea Flicker added 1 commit 2026-05-27 00:54:08 +00:00
docs(UAT_PLAYBOOK.md): add TC-WEB-SSO-ROLE-* test cases for GRO-1822
CI / Test (pull_request) Successful in 15s
CI / Lint & Typecheck (pull_request) Successful in 17s
CI / Build & Push Docker Image (pull_request) Successful in 34s
4213c1f2e7
Add section 5.4.3 covering role-based redirect after SSO login:
- Customer SSO → portal at / (not redirected to /admin)
- Staff SSO → redirect to /admin
- Impersonation bypass via ?sessionId= preserved
- Dev mode unaffected

Refs: GRO-1822
Flea Flicker added 1 commit 2026-05-27 02:20:46 +00:00
fix: add skipWaiting/clientsClaim to VitePWA workbox config
CI / Test (pull_request) Successful in 13s
CI / Lint & Typecheck (pull_request) Successful in 25s
CI / Build & Push Docker Image (pull_request) Successful in 50s
85294b108d
Root cause: SW remained in waiting phase after redeploy, serving stale
precached assets. Without skipWaiting/clientsClaim the old SW persisted
and controlled the page even after a new SW was installed.

Fixes blank-page regression where React never mounted on login.
Author
Member

Closing as superseded.

The role-based redirect fix for GRO-1822 was merged to dev via PR #30. The current dev branch already contains the staff/customer redirect guard in src/App.tsx:

const isStaff = session?.user && (session.user as any).role === "staff";
if (!authDisabled && session && !location.pathname.startsWith("/admin") && !searchParams.has("sessionId") && isStaff) {
  return <Navigate to="/admin" replace />;
}

Deployment to UAT tracked under GRO-1824 (done). Closed as part of GRO-1847 hygiene sweep.

Closing as superseded. The role-based redirect fix for [GRO-1822](/GRO/issues/GRO-1822) was merged to `dev` via PR #30. The current `dev` branch already contains the staff/customer redirect guard in `src/App.tsx`: ```tsx const isStaff = session?.user && (session.user as any).role === "staff"; if (!authDisabled && session && !location.pathname.startsWith("/admin") && !searchParams.has("sessionId") && isStaff) { return <Navigate to="/admin" replace />; } ``` Deployment to UAT tracked under [GRO-1824](/GRO/issues/GRO-1824) (done). Closed as part of [GRO-1847](/GRO/issues/GRO-1847) hygiene sweep.
The Dogfather closed this pull request 2026-05-29 08:35:25 +00:00
Some checks are pending
CI / Test (pull_request) Successful in 13s
CI / Lint & Typecheck (pull_request) Successful in 25s
CI / Build & Push Docker Image (pull_request) Successful in 50s

Pull request closed

Sign in to join this conversation.