feat(ST-111ci8t4): admin user-actions (delete, updateRoles, setMustResetPassword)
- 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')
This commit is contained in:
parent
71281038ff
commit
5fd56e3f67
3 changed files with 52 additions and 0 deletions
|
|
@ -22,3 +22,11 @@ export async function requireSession() {
|
|||
|
||||
return session
|
||||
}
|
||||
|
||||
export async function requireAdmin() {
|
||||
const session = await getSession()
|
||||
if (!session.userId || !session.isAdmin) {
|
||||
redirect('/dashboard')
|
||||
}
|
||||
return session
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue