From d154fc412ea0c0e1b3cc4315120882bdc8942e1e Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Tue, 19 Jul 2022 14:07:28 +0800 Subject: [PATCH] feat: ui permission binding see https://github.com/halo-dev/halo/pull/2260 --- src/main.ts | 6 ++---- src/modules/system/plugins/PluginDetail.vue | 2 +- src/modules/system/plugins/PluginList.vue | 12 ++++++++--- src/modules/system/plugins/module.ts | 6 ++++++ src/modules/system/roles/RoleDetail.vue | 4 ++-- src/modules/system/roles/RoleList.vue | 11 ++++++++-- src/modules/system/roles/module.ts | 6 ++++++ src/modules/system/users/UserList.vue | 24 ++++++++++++++++----- src/modules/system/users/module.ts | 3 +++ src/router/guards/permission.ts | 2 +- src/utils/__tests__/permission.spec.ts | 4 ++-- src/utils/permission.ts | 2 +- 12 files changed, 61 insertions(+), 21 deletions(-) diff --git a/src/main.ts b/src/main.ts index 236e0818..ec6a896b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -144,9 +144,7 @@ async function loadCurrentUser() { const { data: user } = await apiClient.user.getCurrentUserDetail(); app.provide("currentUser", user); - const { data: currentPermissions } = await apiClient.user.getPermissions( - user.metadata.name - ); + const { data: currentPermissions } = await apiClient.user.getPermissions("-"); const roleStore = useRoleStore(); roleStore.$patch({ permissions: currentPermissions, @@ -174,7 +172,7 @@ async function loadCurrentUser() { })(); async function initApp() { - // TODO 实验性特性 + // TODO 实验性 const theme = localStorage.getItem("theme"); if (theme) { document.body.classList.add(theme); diff --git a/src/modules/system/plugins/PluginDetail.vue b/src/modules/system/plugins/PluginDetail.vue index e7dce4b8..33880646 100644 --- a/src/modules/system/plugins/PluginDetail.vue +++ b/src/modules/system/plugins/PluginDetail.vue @@ -213,7 +213,7 @@ onMounted(handleFetchPlugin);

-
+