fix: navigation with restricted permissions

This commit is contained in:
Julian Krauser 2025-07-24 08:49:18 +02:00
parent 89bc0f9373
commit e10bfdd315
6 changed files with 18 additions and 7 deletions

View file

@ -19,11 +19,16 @@ export async function abilityAndNavUpdate(to: any, from: any, next: any) {
navigation.updateNavigation();
NProgress.done();
next();
} else if ((admin && ability.isAdmin()) || ability.can(type, section, module)) {
} else if (module && ((admin && ability.isAdmin()) || ability.can(type, section, module))) {
NProgress.done();
navigation.activeNavigation = to.name.split("-")[1];
navigation.activeLink = to.name.split("-")[2];
next();
} else if (!module && ((admin && ability.isAdmin()) || ability.canSection(type, section))) {
NProgress.done();
navigation.activeNavigation = to.name.split("-")[1];
navigation.activeLink = null;
next();
} else {
NProgress.done();
next({ name: "admin-default" });