Browse Source

fix(gui-v2): add missing isUIAllowed for UserManagement & ApiTokenManagement

pull/3475/head
Wing-Kam Wong 2 years ago
parent
commit
c83a145604
  1. 10
      packages/nc-gui-v2/components/tabs/Auth.vue

10
packages/nc-gui-v2/components/tabs/Auth.vue

@ -2,22 +2,30 @@
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import UserManagement from './auth/UserManagement.vue' import UserManagement from './auth/UserManagement.vue'
import ApiTokenManagement from './auth/ApiTokenManagement.vue' import ApiTokenManagement from './auth/ApiTokenManagement.vue'
import { useUIPermission } from '#imports'
interface Tab { interface Tab {
title: string title: string
label: string
body: any body: any
isUIAllowed: boolean
} }
const { t } = useI18n() const { t } = useI18n()
const { isUIAllowed } = useUIPermission()
const tabsInfo: Tab[] = [ const tabsInfo: Tab[] = [
{ {
title: 'Users Management', title: 'Users Management',
label: t('title.userMgmt'), label: t('title.userMgmt'),
body: () => UserManagement, body: () => UserManagement,
isUIAllowed: isUIAllowed('userMgmtTab'),
}, },
{ {
title: 'API Token Management', title: 'API Token Management',
label: t('title.apiTokenMgmt'), label: t('title.apiTokenMgmt'),
body: () => ApiTokenManagement, body: () => ApiTokenManagement,
isUIAllowed: isUIAllowed('apiTokenTab'),
}, },
] ]
@ -28,7 +36,7 @@ const selectedTab = $computed(() => tabsInfo[selectedTabKey])
</script> </script>
<template> <template>
<div> <div v-if="selectedTab.isUIAllowed">
<a-tabs v-model:active-key="selectedTabKey" :open-keys="[]" mode="horizontal" class="nc-auth-tabs !mx-6"> <a-tabs v-model:active-key="selectedTabKey" :open-keys="[]" mode="horizontal" class="nc-auth-tabs !mx-6">
<a-tab-pane v-for="(tab, key) of tabsInfo" :key="key" class="select-none"> <a-tab-pane v-for="(tab, key) of tabsInfo" :key="key" class="select-none">
<template #tab> <template #tab>

Loading…
Cancel
Save