Browse Source

fix: super admin access fe

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/6333/head
mertmit 1 year ago
parent
commit
52adf6168d
  1. 4
      packages/nc-gui/middleware/auth.global.ts

4
packages/nc-gui/middleware/auth.global.ts

@ -85,7 +85,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
} }
} else { } else {
/** If page is limited to certain users verify the user have the roles */ /** 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.") message.error("You don't have enough permission to access the page.")
return navigateTo('/') return navigateTo('/')
} }
@ -94,7 +94,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
if (to.params.projectId && from.params.projectId !== to.params.projectId) { if (to.params.projectId && from.params.projectId !== to.params.projectId) {
const user = await api.auth.me({ project_id: to.params.projectId as string }) 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.") message.error("You don't have enough permission to access the project.")
return navigateTo('/') return navigateTo('/')

Loading…
Cancel
Save