|
|
|
@ -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('/') |
|
|
|
|