docs: update TEKNISK_BESKRIVNING.md to reflect changes in authentication middleware and role-based access control; remove obsolete middleware.ts file

This commit is contained in:
Nils-Johan Gynther
2026-04-21 10:30:30 +02:00
parent 60f6064664
commit 8e9b90028f
2 changed files with 1 additions and 20 deletions
-19
View File
@@ -1,19 +0,0 @@
import { auth } from './auth';
import { NextResponse } from 'next/server';
export default auth((req) => {
const { pathname } = req.nextUrl;
if (pathname.startsWith('/admin')) {
const role = (req.auth?.user as any)?.role;
if (role !== 'admin') {
const loginUrl = new URL('/login', req.url);
loginUrl.searchParams.set('callbackUrl', pathname);
return NextResponse.redirect(loginUrl);
}
}
});
export const config = {
matcher: ['/admin/:path*'],
};