feat(auth): implement role-based access control and user management features

This commit is contained in:
Nils-Johan Gynther
2026-04-18 09:34:22 +02:00
parent 20330f6410
commit c5ccef2313
22 changed files with 358 additions and 10 deletions
+8
View File
@@ -17,6 +17,14 @@ export default auth((req) => {
return NextResponse.redirect(loginUrl);
}
// Admin-sidor kräver admin-roll
if (pathname.startsWith('/admin')) {
const role = (req.auth.user as any)?.role;
if (role !== 'admin') {
return NextResponse.redirect(new URL('/', req.url));
}
}
return NextResponse.next();
});