diff --git a/src/App.vue b/src/App.vue index 587c449..5842e29 100644 --- a/src/App.vue +++ b/src/App.vue @@ -16,7 +16,7 @@ import Header from "./components/Header.vue"; import Footer from "./components/Footer.vue"; import { mapState } from "pinia"; import { useAuthStore } from "./stores/auth"; -import { isAuthenticatedPromise } from "./router/authGuards"; +import { isAuthenticatedPromise } from "./router/authGuard"; import ContextMenu from "./components/ContextMenu.vue"; import Modal from "./components/Modal.vue"; diff --git a/src/components/UserMenu.vue b/src/components/UserMenu.vue index 8c5bbe8..833238b 100644 --- a/src/components/UserMenu.vue +++ b/src/components/UserMenu.vue @@ -26,7 +26,9 @@ - ausloggen + + ausloggen + diff --git a/src/main.css b/src/main.css index a8dcd0c..60e72ac 100644 --- a/src/main.css +++ b/src/main.css @@ -56,8 +56,7 @@ body { @apply w-full h-full overflow-hidden flex flex-col; } -/* :not([headlessui]):not([id*="headlessui"]):not([class*="headlessui"]) */ -button:not([class*="ql"] *):not([class*="fc"]), +button:not([class*="ql"] *):not([class*="fc"]):not([headlessui]):not([id*="headlessui"]):not([class*="headlessui"]), a[button] { @apply relative box-border h-10 w-full flex justify-center py-2 px-4 text-sm font-medium rounded-md focus:outline-none focus:ring-0; } diff --git a/src/router/adminGuard.ts b/src/router/adminGuard.ts index 4dc2c32..27a1c27 100644 --- a/src/router/adminGuard.ts +++ b/src/router/adminGuard.ts @@ -22,3 +22,16 @@ export async function abilityAndNavUpdate(to: any, from: any, next: any) { next(false); } } + +export async function isOwner(to: any, from: any, next: any) { + NProgress.start(); + const ability = useAbilityStore(); + + if (ability.isOwner) { + NProgress.done(); + next(); + } else { + NProgress.done(); + next(false); + } +} diff --git a/src/router/authGuards.ts b/src/router/authGuard.ts similarity index 93% rename from src/router/authGuards.ts rename to src/router/authGuard.ts index 9b15f57..a180065 100644 --- a/src/router/authGuards.ts +++ b/src/router/authGuard.ts @@ -35,7 +35,7 @@ export async function isAuthenticated(to: any, from: any, next: any) { }); } -export async function isAuthenticatedPromise(): Promise { +export async function isAuthenticatedPromise(forceRefresh: boolean = false): Promise { return new Promise(async (resolve, reject) => { const auth = useAuthStore(); const account = useAccountStore(); @@ -55,7 +55,7 @@ export async function isAuthenticatedPromise(): Promise { // check jwt expiry const exp = decoded.exp ?? 0; const correctedLocalTime = new Date().getTime(); - if (exp < Math.floor(correctedLocalTime / 1000)) { + if (exp < Math.floor(correctedLocalTime / 1000) || forceRefresh) { await refreshToken() .then(() => { console.log("fetched new token"); diff --git a/src/router/index.ts b/src/router/index.ts index 332b69e..e25c686 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,7 +1,7 @@ import { createRouter, createWebHistory } from "vue-router"; import Login from "@/views/Login.vue"; -import { isAuthenticated } from "./authGuards"; +import { isAuthenticated } from "./authGuard"; import { loadAccountData } from "./accountGuard"; import { isSetup } from "./setupGuard"; import { abilityAndNavUpdate } from "./adminGuard"; @@ -476,6 +476,11 @@ const router = createRouter({ name: "account-permission", component: () => import("@/views/account/Permission.vue"), }, + { + path: "administration", + name: "account-administration", + component: () => import("@/views/account/Administration.vue"), + }, { path: ":pathMatch(.*)*", name: "account-404", diff --git a/src/serverCom.ts b/src/serverCom.ts index 9022b09..bbfb6e9 100644 --- a/src/serverCom.ts +++ b/src/serverCom.ts @@ -1,5 +1,5 @@ import axios from "axios"; -import { isAuthenticatedPromise, type Payload } from "./router/authGuards"; +import { isAuthenticatedPromise, type Payload } from "./router/authGuard"; import router from "./router"; let devMode = process.env.NODE_ENV === "development"; diff --git a/src/views/account/Administration.vue b/src/views/account/Administration.vue new file mode 100644 index 0000000..cccf913 --- /dev/null +++ b/src/views/account/Administration.vue @@ -0,0 +1,162 @@ + + + + + Administration übertragen + + + + + laden fehlgeschlagen + + + + Nutzer suchen + + + + + + + + + + Keine Auswahl + + + + + + + {{ user.firstname }} {{ user.lastname }} {{ user.nameaffix }} + + + + + + + + + + + + + abbrechen + + übertragen + + + + + + + + + + + + + diff --git a/src/views/account/View.vue b/src/views/account/View.vue index 1787a26..8fbb992 100644 --- a/src/views/account/View.vue +++ b/src/views/account/View.vue @@ -3,7 +3,11 @@ - + diff --git a/src/views/admin/club/protocol/ProtocolPresence.vue b/src/views/admin/club/protocol/ProtocolPresence.vue index 33ec600..5a9f616 100644 --- a/src/views/admin/club/protocol/ProtocolPresence.vue +++ b/src/views/admin/club/protocol/ProtocolPresence.vue @@ -95,7 +95,7 @@ import { TrashIcon } from "@heroicons/vue/24/outline"; import { useProtocolStore } from "@/stores/admin/protocol"; import { useMemberStore } from "@/stores/admin/member"; import type { MemberViewModel } from "@/viewmodels/admin/member.models"; -import { useProtocolPresenceStore } from "../../../../stores/admin/protocolPresence"; +import { useProtocolPresenceStore } from "@/stores/admin/protocolPresence";
laden fehlgeschlagen