Merge branch 'develop' into milestone/ff-admin-unit
This commit is contained in:
commit
4ebacc5f52
107 changed files with 4980 additions and 1739 deletions
|
@ -55,6 +55,7 @@ export async function isAuthenticatedPromise(forceRefresh: boolean = false): Pro
|
|||
// check jwt expiry
|
||||
const exp = decoded.exp ?? 0;
|
||||
const correctedLocalTime = new Date().getTime();
|
||||
let failedRefresh = false;
|
||||
if (exp < Math.floor(correctedLocalTime / 1000) || forceRefresh) {
|
||||
await refreshToken()
|
||||
.then(() => {
|
||||
|
@ -63,13 +64,16 @@ export async function isAuthenticatedPromise(forceRefresh: boolean = false): Pro
|
|||
.catch((err: string) => {
|
||||
console.log("expired");
|
||||
auth.setFailed();
|
||||
failedRefresh = true;
|
||||
reject(err);
|
||||
});
|
||||
}
|
||||
|
||||
if (failedRefresh) return;
|
||||
|
||||
var { userId, firstname, lastname, mail, username, permissions, isOwner } = decoded;
|
||||
|
||||
if (Object.keys(permissions ?? {}).length === 0 && !isOwner) {
|
||||
if (Object.keys(permissions ?? {}).filter((p) => p != "adminByOwner").length === 0 && !isOwner) {
|
||||
auth.setFailed();
|
||||
reject("nopermissions");
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useBackupStore } from "../stores/admin/management/backup";
|
||||
import { useBackupStore } from "@/stores/admin/management/backup";
|
||||
|
||||
export async function setBackupPage(to: any, from: any, next: any) {
|
||||
const backup = useBackupStore();
|
||||
|
|
|
@ -2,14 +2,12 @@ import { createRouter, createWebHistory } from "vue-router";
|
|||
import Login from "@/views/Login.vue";
|
||||
|
||||
import { isAuthenticated } from "./authGuard";
|
||||
import { loadAccountData } from "./accountGuard";
|
||||
import { isSetup } from "./setupGuard";
|
||||
import { abilityAndNavUpdate } from "./adminGuard";
|
||||
import type { PermissionType, PermissionSection, PermissionModule } from "@/types/permissionTypes";
|
||||
import { resetMemberStores, setMemberId } from "./memberGuard";
|
||||
import { resetProtocolStores, setProtocolId } from "./protocolGuard";
|
||||
import { resetNewsletterStores, setNewsletterId } from "./newsletterGuard";
|
||||
import { config } from "../config";
|
||||
import { setBackupPage } from "./backupGuard";
|
||||
|
||||
const router = createRouter({
|
||||
|
@ -649,6 +647,13 @@ const router = createRouter({
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "settings",
|
||||
name: "admin-management-setting",
|
||||
component: () => import("@/views/admin/management/setting/Setting.vue"),
|
||||
meta: { type: "read", section: "management", module: "setting" },
|
||||
beforeEnter: [abilityAndNavUpdate],
|
||||
},
|
||||
{
|
||||
path: "backup",
|
||||
name: "admin-management-backup-route",
|
||||
|
@ -784,10 +789,6 @@ const router = createRouter({
|
|||
],
|
||||
});
|
||||
|
||||
router.afterEach((to, from) => {
|
||||
document.title = config.app_name_overwrite || "FF Admin";
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
declare module "vue-router" {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { useNewsletterStore } from "@/stores/admin/club/newsletter/newsletter";
|
||||
import { useNewsletterDatesStore } from "@/stores/admin/club/newsletter/newsletterDates";
|
||||
import { useNewsletterRecipientsStore } from "@/stores/admin/club/newsletter/newsletterRecipients";
|
||||
import { useNewsletterPrintoutStore } from "../stores/admin/club/newsletter/newsletterPrintout";
|
||||
import { useNewsletterPrintoutStore } from "@/stores/admin/club/newsletter/newsletterPrintout";
|
||||
|
||||
export async function setNewsletterId(to: any, from: any, next: any) {
|
||||
const newsletter = useNewsletterStore();
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useProtocolAgendaStore } from "@/stores/admin/club/protocol/protocolAge
|
|||
import { useProtocolDecisionStore } from "@/stores/admin/club/protocol/protocolDecision";
|
||||
import { useProtocolPresenceStore } from "@/stores/admin/club/protocol/protocolPresence";
|
||||
import { useProtocolVotingStore } from "@/stores/admin/club/protocol/protocolVoting";
|
||||
import { useProtocolPrintoutStore } from "../stores/admin/club/protocol/protocolPrintout";
|
||||
import { useProtocolPrintoutStore } from "@/stores/admin/club/protocol/protocolPrintout";
|
||||
|
||||
export async function setProtocolId(to: any, from: any, next: any) {
|
||||
const protocol = useProtocolStore();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue