diff --git a/src/router/index.ts b/src/router/index.ts index 2d39254..1c4d4e4 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -661,6 +661,11 @@ const router = createRouter({ }, ], }, + { + path: "version", + name: "admin-user-version", + component: () => import("@/views/admin/user/version/VersionDisplay.vue"), + }, ], }, { @@ -701,11 +706,6 @@ const router = createRouter({ name: "account-administration", component: () => import("@/views/account/Administration.vue"), }, - { - path: "version", - name: "account-version", - component: () => import("@/views/account/VersionDisplay.vue"), - }, { path: ":pathMatch(.*)*", name: "account-404", diff --git a/src/stores/ability.ts b/src/stores/ability.ts index 5b8a951..d5190af 100644 --- a/src/stores/ability.ts +++ b/src/stores/ability.ts @@ -43,6 +43,11 @@ export const useAbilityStore = defineStore("ability", { return true; return false; }, + isAdmin: (state) => (): boolean => { + const permissions = state.permissions; + if (state.isOwner) return true; + return permissions?.admin ?? false; + }, _can: () => ( diff --git a/src/stores/admin/navigation.ts b/src/stores/admin/navigation.ts index 07a7532..33297b6 100644 --- a/src/stores/admin/navigation.ts +++ b/src/stores/admin/navigation.ts @@ -134,6 +134,7 @@ export const useNavigationStore = defineStore("navigation", { ...(abilityStore.can("read", "user", "role") ? [{ key: "role", title: "Rollen" }] : []), ...(abilityStore.can("read", "user", "webapi") ? [{ key: "webapi", title: "Webapi-Token" }] : []), ...(abilityStore.can("read", "user", "backup") ? [{ key: "backup", title: "Backups" }] : []), + ...(abilityStore.isAdmin() ? [{ key: "version", title: "Version" }] : []), ], }, } as navigationModel; diff --git a/src/views/account/View.vue b/src/views/account/View.vue index 465f913..8662849 100644 --- a/src/views/account/View.vue +++ b/src/views/account/View.vue @@ -12,11 +12,6 @@ :link="{ name: 'account-administration' }" :active="activeRouteName == 'account-administration'" /> -