diff --git a/src/components/Footer.vue b/src/components/Footer.vue
index f1082c4..eda9403 100644
--- a/src/components/Footer.vue
+++ b/src/components/Footer.vue
@@ -6,7 +6,7 @@
@@ -46,7 +46,7 @@ import { useConfigurationStore } from "@/stores/configuration";
export default defineComponent({
computed: {
...mapState(useAuthStore, ["authCheck"]),
- ...mapState(useNavigationStore, ["topLevel"]),
+ ...mapState(useNavigationStore, ["topLevelObject"]),
...mapState(useConfigurationStore, ["clubName"]),
routeName() {
return typeof this.$route.name == "string" ? this.$route.name : "";
diff --git a/src/router/adminGuard.ts b/src/router/adminGuard.ts
index 8016b7d..26396d9 100644
--- a/src/router/adminGuard.ts
+++ b/src/router/adminGuard.ts
@@ -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" });
diff --git a/src/stores/ability.ts b/src/stores/ability.ts
index ed65b5f..26cfa52 100644
--- a/src/stores/ability.ts
+++ b/src/stores/ability.ts
@@ -33,7 +33,8 @@ export const useAbilityStore = defineStore("ability", {
if (type == "admin") return permissions?.admin ?? permissions?.adminByOwner ?? false;
if (permissions?.admin || permissions?.adminByOwner) return true;
if (
- (permissions[section]?.all == "*" || permissions[section]?.all?.includes(type)) &&
+ permissions[section]?.all == "*" ||
+ permissions[section]?.all?.includes(type) ||
permissions[section] != undefined
)
return true;
diff --git a/src/stores/admin/navigation.ts b/src/stores/admin/navigation.ts
index 3b14619..566fccd 100644
--- a/src/stores/admin/navigation.ts
+++ b/src/stores/admin/navigation.ts
@@ -37,6 +37,11 @@ export const useNavigationStore = defineStore("navigation", {
};
},
getters: {
+ topLevelObject: (state) =>
+ state.topLevel.map((tl) => ({
+ ...tl,
+ levelDefault: state.navigation[tl.key].main.filter((m) => !m.key.includes("divider"))[0]?.key ?? "",
+ })),
activeNavigationObject: (state) => (state.navigation[state.activeNavigation] ?? {}) as navigationSplitModel,
activeTopLevelObject: (state) =>
(state.topLevel.find((elem) => elem.key == state.activeNavigation) ?? {}) as topLevelNavigationModel,
diff --git a/src/views/NoPermission.vue b/src/views/NoPermission.vue
index d953327..ddf2841 100644
--- a/src/views/NoPermission.vue
+++ b/src/views/NoPermission.vue
@@ -1,5 +1,5 @@
-