patches v1.7.5 #120
6 changed files with 18 additions and 7 deletions
|
@ -6,7 +6,7 @@
|
||||||
<div class="w-full flex flex-row gap-2 h-full align-middle">
|
<div class="w-full flex flex-row gap-2 h-full align-middle">
|
||||||
<TopLevelLink
|
<TopLevelLink
|
||||||
v-if="routeName == 'admin' || routeName.includes('admin-')"
|
v-if="routeName == 'admin' || routeName.includes('admin-')"
|
||||||
v-for="item in topLevel"
|
v-for="item in topLevelObject"
|
||||||
:key="item.key"
|
:key="item.key"
|
||||||
:link="item"
|
:link="item"
|
||||||
:disableSubLink="true"
|
:disableSubLink="true"
|
||||||
|
@ -34,7 +34,7 @@ import TopLevelLink from "./admin/TopLevelLink.vue";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useAuthStore, ["authCheck"]),
|
...mapState(useAuthStore, ["authCheck"]),
|
||||||
...mapState(useNavigationStore, ["topLevel"]),
|
...mapState(useNavigationStore, ["topLevelObject"]),
|
||||||
routeName() {
|
routeName() {
|
||||||
return typeof this.$route.name == "string" ? this.$route.name : "";
|
return typeof this.$route.name == "string" ? this.$route.name : "";
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div v-if="authCheck" class="hidden md:flex flex-row gap-2 h-full align-middle">
|
<div v-if="authCheck" class="hidden md:flex flex-row gap-2 h-full align-middle">
|
||||||
<TopLevelLink
|
<TopLevelLink
|
||||||
v-if="routeName == 'admin' || routeName.includes('admin-')"
|
v-if="routeName == 'admin' || routeName.includes('admin-')"
|
||||||
v-for="item in topLevel"
|
v-for="item in topLevelObject"
|
||||||
:key="item.key"
|
:key="item.key"
|
||||||
:link="item"
|
:link="item"
|
||||||
/>
|
/>
|
||||||
|
@ -46,7 +46,7 @@ import { useConfigurationStore } from "@/stores/configuration";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useAuthStore, ["authCheck"]),
|
...mapState(useAuthStore, ["authCheck"]),
|
||||||
...mapState(useNavigationStore, ["topLevel"]),
|
...mapState(useNavigationStore, ["topLevelObject"]),
|
||||||
...mapState(useConfigurationStore, ["clubName"]),
|
...mapState(useConfigurationStore, ["clubName"]),
|
||||||
routeName() {
|
routeName() {
|
||||||
return typeof this.$route.name == "string" ? this.$route.name : "";
|
return typeof this.$route.name == "string" ? this.$route.name : "";
|
||||||
|
|
|
@ -19,11 +19,16 @@ export async function abilityAndNavUpdate(to: any, from: any, next: any) {
|
||||||
navigation.updateNavigation();
|
navigation.updateNavigation();
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
next();
|
next();
|
||||||
} else if ((admin && ability.isAdmin()) || ability.can(type, section, module)) {
|
} else if (module && ((admin && ability.isAdmin()) || ability.can(type, section, module))) {
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
navigation.activeNavigation = to.name.split("-")[1];
|
navigation.activeNavigation = to.name.split("-")[1];
|
||||||
navigation.activeLink = to.name.split("-")[2];
|
navigation.activeLink = to.name.split("-")[2];
|
||||||
next();
|
next();
|
||||||
|
} else if (!module && ((admin && ability.isAdmin()) || ability.canSection(type, section))) {
|
||||||
|
NProgress.done();
|
||||||
|
navigation.activeNavigation = to.name.split("-")[1];
|
||||||
|
navigation.activeLink = null;
|
||||||
|
next();
|
||||||
} else {
|
} else {
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
next({ name: "admin-default" });
|
next({ name: "admin-default" });
|
||||||
|
|
|
@ -33,7 +33,8 @@ export const useAbilityStore = defineStore("ability", {
|
||||||
if (type == "admin") return permissions?.admin ?? permissions?.adminByOwner ?? false;
|
if (type == "admin") return permissions?.admin ?? permissions?.adminByOwner ?? false;
|
||||||
if (permissions?.admin || permissions?.adminByOwner) return true;
|
if (permissions?.admin || permissions?.adminByOwner) return true;
|
||||||
if (
|
if (
|
||||||
(permissions[section]?.all == "*" || permissions[section]?.all?.includes(type)) &&
|
permissions[section]?.all == "*" ||
|
||||||
|
permissions[section]?.all?.includes(type) ||
|
||||||
permissions[section] != undefined
|
permissions[section] != undefined
|
||||||
)
|
)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -37,6 +37,11 @@ export const useNavigationStore = defineStore("navigation", {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getters: {
|
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,
|
activeNavigationObject: (state) => (state.navigation[state.activeNavigation] ?? {}) as navigationSplitModel,
|
||||||
activeTopLevelObject: (state) =>
|
activeTopLevelObject: (state) =>
|
||||||
(state.topLevel.find((elem) => elem.key == state.activeNavigation) ?? {}) as topLevelNavigationModel,
|
(state.topLevel.find((elem) => elem.key == state.activeNavigation) ?? {}) as topLevelNavigationModel,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col items-center">
|
<div class="flex flex-col gap-2 items-center">
|
||||||
<br />
|
<br />
|
||||||
<h1 class="w-full p-4 text-center font-bold text-3xl">Kein Zugriff</h1>
|
<h1 class="w-full p-4 text-center font-bold text-3xl">Kein Zugriff</h1>
|
||||||
<br />
|
<br />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue