From 52adf6168dd0b59f74da046b26536a6334eafd6b Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 8 Sep 2023 14:20:51 +0300 Subject: [PATCH] fix: super admin access fe Signed-off-by: mertmit --- packages/nc-gui/middleware/auth.global.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/middleware/auth.global.ts b/packages/nc-gui/middleware/auth.global.ts index 571e094baf..64702addf7 100644 --- a/packages/nc-gui/middleware/auth.global.ts +++ b/packages/nc-gui/middleware/auth.global.ts @@ -85,7 +85,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => { } } else { /** If page is limited to certain users verify the user have the roles */ - if (to.meta.allowedRoles && to.meta.allowedRoles.every((role) => !allRoles.value[role])) { + if (to.meta.allowedRoles && to.meta.allowedRoles.every((role) => !allRoles.value?.[role])) { message.error("You don't have enough permission to access the page.") return navigateTo('/') } @@ -94,7 +94,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => { if (to.params.projectId && from.params.projectId !== to.params.projectId) { const user = await api.auth.me({ project_id: to.params.projectId as string }) - if (user?.roles?.user) { + if (user?.roles?.guest) { message.error("You don't have enough permission to access the project.") return navigateTo('/')