From 0fddeaa0361f901602189c24451e8ec8890d1472 Mon Sep 17 00:00:00 2001 From: "xiaozhe.ma" Date: Sun, 24 Nov 2024 19:00:17 +0900 Subject: [PATCH] =?UTF-8?q?=E6=A8=A9=E9=99=90=E5=A4=89=E6=9B=B4=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/router/routes.ts | 2 +- frontend/src/stores/useAuthStore.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/router/routes.ts b/frontend/src/router/routes.ts index 95e5cbd..1b999ad 100644 --- a/frontend/src/router/routes.ts +++ b/frontend/src/router/routes.ts @@ -25,7 +25,7 @@ const routes: RouteRecordRaw[] = [ // { path: 'FlowChart', component: () => import('pages/FlowChart.vue') }, { path: 'right', component: () => import('pages/testRight.vue') }, { path: 'domain', component: () => import('pages/TenantDomain.vue') }, - // { path: 'userdomain', component: () => import('pages/UserDomain.vue')}, + { path: 'userdomain', component: () => import('pages/UserDomain.vue')}, { path: 'user', component: () => import('pages/UserManagement.vue')}, { path: 'app', component: () => import('pages/AppManagement.vue')}, { path: 'condition', component: () => import('pages/conditionPage.vue') } diff --git a/frontend/src/stores/useAuthStore.ts b/frontend/src/stores/useAuthStore.ts index f2a0895..985d893 100644 --- a/frontend/src/stores/useAuthStore.ts +++ b/frontend/src/stores/useAuthStore.ts @@ -16,7 +16,8 @@ export interface IUserState { LeftDrawer: boolean; userId?: string; userInfo: UserInfo; - permissions: 'admin' | 'user'; + roles:string, + permissions: string; } export const useAuthStore = defineStore('auth', { @@ -27,7 +28,8 @@ export const useAuthStore = defineStore('auth', { currentDomain: {} as IDomainInfo, userId: '', userInfo: {} as UserInfo, - permissions: 'user', + roles:'', + permissions: '', }), getters: { toggleLeftDrawer(): boolean { @@ -51,7 +53,7 @@ export const useAuthStore = defineStore('auth', { this.token = result.data.access_token; const tokenJson = jwtDecode(result.data.access_token); this.userId = tokenJson.sub; - this.permissions = (tokenJson as any).permissions ?? 'user'; + this.permissions = (tokenJson as any).permissions==='ALL' ? 'admin': 'user'; api.defaults.headers['Authorization'] = 'Bearer ' + this.token; this.currentDomain = await this.getCurrentDomain(); this.userInfo = await this.getUserInfo();