- lib/session.ts: isAdmin: boolean toegevoegd aan SessionData
- lib/auth-guard.ts: requireAdmin() toegevoegd (redirect /dashboard bij !isAdmin)
- actions/admin/users.ts: deleteUserAction (zelfbescherming), updateUserRolesAction
(Zod z.nativeEnum, eigen ADMIN-rol-beveiliging, transactie), setMustResetPasswordAction
— alle drie 'use server', revalidatePath('/admin/users')
21 lines
608 B
TypeScript
21 lines
608 B
TypeScript
import { SessionOptions } from 'iron-session'
|
|
|
|
export interface SessionData {
|
|
userId: string
|
|
isDemo: boolean
|
|
isAdmin: boolean
|
|
// ST-1002 (M10) — gezet door /api/auth/pair/claim na een succesvolle QR-pairing.
|
|
// Beide velden zijn optioneel zodat bestaande wachtwoord-sessies onveranderd blijven.
|
|
paired?: boolean
|
|
pairedExpiresAt?: number // unix ms
|
|
}
|
|
|
|
export const sessionOptions: SessionOptions = {
|
|
password: process.env.SESSION_SECRET!,
|
|
cookieName: 'scrum4me-session',
|
|
cookieOptions: {
|
|
secure: process.env.NODE_ENV === 'production',
|
|
httpOnly: true,
|
|
sameSite: 'lax',
|
|
},
|
|
}
|