From a487a1f2aa34d82efa150a4ad2edb70913a3f06a Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Wed, 26 Aug 2020 15:45:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=B8=BA=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E8=AE=BE=E7=BD=AEroles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/business/components/settings/SettingMenu.vue | 4 +++- frontend/src/business/components/settings/router.js | 6 +++++- frontend/src/business/permission.js | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/src/business/components/settings/SettingMenu.vue b/frontend/src/business/components/settings/SettingMenu.vue index 33edf1924b..ea9af8de10 100644 --- a/frontend/src/business/components/settings/SettingMenu.vue +++ b/frontend/src/business/components/settings/SettingMenu.vue @@ -35,7 +35,8 @@ {{ $t('commons.personal_info') }} - + {{ $t(menu.title) }} @@ -56,6 +57,7 @@ export default { if (child.meta[group] === true) { let menu = {index: Setting.path + "/" + child.path} menu.title = child.meta.title; + menu.roles = child.meta.roles; menus.push(menu); } }) diff --git a/frontend/src/business/components/settings/router.js b/frontend/src/business/components/settings/router.js index 659176b95e..d1cb83e51d 100644 --- a/frontend/src/business/components/settings/router.js +++ b/frontend/src/business/components/settings/router.js @@ -67,7 +67,11 @@ export default { { path: 'apikeys', component: () => import(/* webpackChunkName: "setting" */ '@/business/components/settings/personal/ApiKeys'), - meta: {person: true, title: 'commons.api_keys'} + meta: { + person: true, + title: 'commons.api_keys', + roles: ['test_manager', 'test_user', 'test_viewer', 'org_admin', 'admin'] + } }, ] diff --git a/frontend/src/business/permission.js b/frontend/src/business/permission.js index 4c0ef460d3..62ec88a8a9 100644 --- a/frontend/src/business/permission.js +++ b/frontend/src/business/permission.js @@ -32,7 +32,7 @@ function checkRolePermission(el, binding, type) { el.parentNode && el.parentNode.removeChild(el) } } else { - throw new Error(`need roles! Like v-permission="['admin','editor']"`) + // throw new Error(`need roles! Like v-permission="['admin','editor']"`) } }