Dependency cleanup

This commit is contained in:
Darren Clarke 2024-08-07 12:02:33 +02:00
parent 2d892779bf
commit 2568547384
28 changed files with 170 additions and 482 deletions

View file

@ -61,7 +61,8 @@ export default withAuth(checkRewrites, {
},
callbacks: {
authorized: ({ token, req }) => {
if (req.nextUrl.pathname.startsWith("/api/v1/")) {
const path = req.nextUrl.pathname;
if (path.startsWith("/api/v1/")) {
return true;
}
@ -70,6 +71,11 @@ export default withAuth(checkRewrites, {
}
const roles: any = token?.roles ?? [];
if (path.startsWith("/admin") && !roles.includes("admin")) {
return false;
}
if (roles.includes("admin") || roles.includes("agent")) {
return true;
}