Personas & User Journeys
The persona system maps the 8 system roles into 6 login selectors. After authentication, users choose their persona, which determines their landing page, visible screens, and proxy-level route guards.
Persona System
Roles are mapped to personas for the login selector. A persona is a coarse-grained routing category that simplifies the post-login experience.
Why personas exist
A single user can have multiple roles (e.g., a Store Manager who also works as a Cashier on weekends). The persona selector lets them choose their "hat" for the day. The choice is stored in the ezvento-persona cookie and drives:
- Route prefix guards (cashiers can't visit /dashboard)
- Default landing page after login
- Menu access (which sidebar items are visible)
- Store-switcher visibility (hidden for single-store cashiers)
Persona Selection Flow
The complete flow from login to landing page, with every API call and cookie interaction.
Proxy-Level Guards
The proxy (src/proxy.ts) enforces persona isolation at the edge, before any page or API handler runs. These guards run on every request.
Implementation in src/proxy.ts
// Cross-persona guard
const personaType = request.cookies.get('ezvento-persona')?.value
if (isDashboard && user && personaType === 'CASHIER') {
return NextResponse.redirect(new URL('/cashier/counter-select', request.url))
}
if (isDashboard && user && personaType === 'HELPER') {
return NextResponse.redirect(new URL('/helper/lookup', request.url))
}
// 2FA enforcement
if (requiresTwoFactor && !twoFactorEnabled) {
return NextResponse.redirect(new URL('/2fa-setup', request.url))
}Per-Persona User Journeys
Detailed breakdown of what each persona sees, does, and accesses on a typical day.
Role Assignment UI
How admins assign roles to users with scope selection in the Team management page.