diff --git a/src/components/Apps/AccountListTable/AccountList.vue b/src/components/Apps/AccountListTable/AccountList.vue index 432e0e9fc..31caddfc7 100644 --- a/src/components/Apps/AccountListTable/AccountList.vue +++ b/src/components/Apps/AccountListTable/AccountList.vue @@ -362,7 +362,7 @@ export default { can: ({ selectedRows }) => { return selectedRows.length > 0 && ['clickhouse', 'redis', 'website', 'chatgpt'].indexOf(selectedRows[0].asset.type.value) === -1 && - !this.$store.getters.currentOrgIsRoot + !this.$store.getters.currentOrgIsRoot && vm.$hasPerm('accounts.verify_account') }, callback: function({ selectedRows }) { const ids = selectedRows.map(v => { diff --git a/src/components/Apps/AccountListTable/const.js b/src/components/Apps/AccountListTable/const.js index 40286a750..4d71a9906 100644 --- a/src/components/Apps/AccountListTable/const.js +++ b/src/components/Apps/AccountListTable/const.js @@ -210,7 +210,7 @@ export const accountOtherActions = vm => { type: 'primary', can: ({ row }) => { return ( - vm.$hasPerm('accounts.add_account') && + vm.$hasPerm('accounts.delete_account') && !vm.$store.getters.currentOrgIsRoot && !isDirectoryServiceAccount(row, vm) ) diff --git a/src/router/pam/activity.js b/src/router/pam/activity.js index f067d229f..91a28b0bd 100644 --- a/src/router/pam/activity.js +++ b/src/router/pam/activity.js @@ -21,7 +21,7 @@ export default [ name: 'AccountSessionList', meta: { title: i18n.t('AccountSessions'), - permissions: [] + permissions: ['accounts.view_accountsession'] } } ] @@ -30,9 +30,6 @@ export default [ path: 'activity', name: 'AccountActivity', component: empty, - redirect: { - name: 'AccountPushList' - }, meta: { app: 'accounts', name: 'BaseAccountActivity', @@ -46,7 +43,7 @@ export default [ name: 'AccountActivityList', meta: { title: i18n.t('AccountActivities'), - permissions: ['audits.view_operatelog'] + permissions: ['accounts.view_accountactivity', 'audits.view_operatelog'] } } ] diff --git a/src/router/pam/index.js b/src/router/pam/index.js index 874571fd8..8f0f38f0a 100644 --- a/src/router/pam/index.js +++ b/src/router/pam/index.js @@ -10,18 +10,18 @@ import store from '@/store' export default { path: '/pam/', - name: 'pam', component: Layout, + name: 'pam', redirect: '/pam/dashboard', meta: { title: i18n.t('PAM'), icon: 'pam', + view: 'pam', type: 'view', showNavSwitcher: () => { return store.getters.pamOrgs.length > 0 }, - permissions: [], - view: 'pam' + permissions: [] }, children: [ { @@ -41,7 +41,7 @@ export default { meta: { title: i18n.t('AccountList'), icon: 'accounts', - permissions: [] + permissions: ['accounts.view_account'] } }, { diff --git a/src/router/pam/security.js b/src/router/pam/security.js index c7127ef64..874942dd4 100644 --- a/src/router/pam/security.js +++ b/src/router/pam/security.js @@ -96,7 +96,7 @@ export default [ name: 'AccountCheckList', meta: { title: i18n.t('RiskDetection'), - permissions: ['accounts.view_accountrisk'] + permissions: ['accounts.view_accountrisk | accounts.view_checkaccountautomation'] } }, { @@ -106,7 +106,7 @@ export default [ hidden: true, meta: { title: i18n.t('AccountCheckCreate'), - permissions: ['accounts.view_accountrisk'] + permissions: ['accounts.add_accountrisk'] } }, { @@ -116,7 +116,7 @@ export default [ hidden: true, meta: { title: i18n.t('AccountCheckUpdate'), - permissions: ['accounts.view_accountrisk'] + permissions: ['accounts.change_accountrisk'] } }, { @@ -125,7 +125,7 @@ export default [ name: 'AccountCheckDetail', meta: { title: i18n.t('RiskDetectionDetail'), - permissions: ['accounts.view_accountrisk'] + permissions: ['accounts.delete_accountrisk'] }, hidden: true }, diff --git a/src/utils/jms/index.js b/src/utils/jms/index.js index f816169ee..2c0a2c66a 100644 --- a/src/utils/jms/index.js +++ b/src/utils/jms/index.js @@ -119,10 +119,10 @@ export function getPermedViews() { const viewShowMapper = [ ['console', store.getters.consoleOrgs.length > 0], ['audit', store.getters.auditOrgs.length > 0], + ['pam', store.getters.pamOrgs.length > 0], ['workbench', true], ['tickets', hasPermission('tickets.view_ticket')], - ['settings', hasPermission('settings.view_setting')], - ['pam', store.getters.consoleOrgs.length > 0] + ['settings', hasPermission('settings.view_setting')] ] return viewShowMapper.filter(i => i[1]).map(i => i[0]) } diff --git a/src/utils/startup.js b/src/utils/startup.js index 8e037734b..5b8a46464 100644 --- a/src/utils/startup.js +++ b/src/utils/startup.js @@ -166,7 +166,7 @@ export async function checkUserFirstLogin({ to, from, next }) { export async function changeCurrentViewIfNeed({ to, from, next }) { let viewName = to.path.split('/')[1] // 这几个是需要检测的, 切换视图组织时,避免 404, 这里不能加 settings, 因为 默认没有返回 setting 组织(System) 的管理权限 - if (['console', 'audit', 'workbench', 'tickets', 'pam', ''].indexOf(viewName) === -1) { + if (['console', 'audit', 'pam', 'workbench', 'tickets', ''].indexOf(viewName) === -1) { Vue.$log.debug('Current view no need check', viewName) return } diff --git a/src/views/accounts/AccountDiscover/DeleteDialog.vue b/src/views/accounts/AccountDiscover/DeleteDialog.vue index 6bed5ed8f..d224601d0 100644 --- a/src/views/accounts/AccountDiscover/DeleteDialog.vue +++ b/src/views/accounts/AccountDiscover/DeleteDialog.vue @@ -113,23 +113,8 @@ export default { } }, mounted() { - if (this.account.id) { - this.getAssetAccount() - } }, methods: { - getAssetAccount() { - const url = '/api/v1/accounts/accounts/' - this.$axios.get(url, { - params: { - username: this.account.username, - asset: this.account.asset.id, - fields_size: 'mini' - } - }).then(res => { - this.assetAccounts = res - }) - }, handleConfirm() { const url = `/api/v1/accounts/gathered-accounts/${this.account.id}/` this.$axios.delete(url, { diff --git a/src/views/accounts/AccountPush/AccountPushExecutionList.vue b/src/views/accounts/AccountPush/AccountPushExecutionList.vue index b9ce2ec1a..8c2e2de3d 100644 --- a/src/views/accounts/AccountPush/AccountPushExecutionList.vue +++ b/src/views/accounts/AccountPush/AccountPushExecutionList.vue @@ -29,7 +29,7 @@ export default { customActions: { name: 'record', title: this.$t('Record'), - can: this.$hasPerm('accounts.view_changesecretrecord'), + can: this.$hasPerm('accounts.view_pushsecretrecord'), callback: function({ row }) { return this.$router.push({ name: 'AccountPush', diff --git a/src/views/accounts/AccountPush/Detail/AccountPushInfo.vue b/src/views/accounts/AccountPush/Detail/AccountPushInfo.vue index 9097b66fd..748cfc820 100644 --- a/src/views/accounts/AccountPush/Detail/AccountPushInfo.vue +++ b/src/views/accounts/AccountPush/Detail/AccountPushInfo.vue @@ -37,7 +37,7 @@ export default { attrs: { type: 'primary', label: this.$t('Execute'), - disabled: !this.$hasPerm('accounts.add_changesecretexecution') || !this.object.is_active + disabled: !this.$hasPerm('accounts.add_pushaccountexecution') || !this.object.is_active }, callbacks: { click: function() { diff --git a/src/views/accounts/RiskDetect/AccountCheckTaskList.vue b/src/views/accounts/RiskDetect/AccountCheckTaskList.vue index ff3e6905e..3f663cc13 100644 --- a/src/views/accounts/RiskDetect/AccountCheckTaskList.vue +++ b/src/views/accounts/RiskDetect/AccountCheckTaskList.vue @@ -114,7 +114,7 @@ export default { type: 'primary', name: 'execute', can: ({ row }) => { - return row.is_active && vm.$hasPerm('accounts.add_checkaccountautomation') + return row.is_active && vm.$hasPerm('accounts.add_checkaccountexecution') }, callback: function({ row }) { this.$axios.post( diff --git a/src/views/accounts/RiskDetect/index.vue b/src/views/accounts/RiskDetect/index.vue index 39c7f229d..49a23cee5 100644 --- a/src/views/accounts/RiskDetect/index.vue +++ b/src/views/accounts/RiskDetect/index.vue @@ -31,13 +31,13 @@ export default { { title: this.$t('ExecutionHistory'), name: 'AccountCheckExecution', - hidden: !this.$hasPerm('accounts.view_checkaccountautomation'), + hidden: !this.$hasPerm('accounts.view_checkaccountexecution'), component: () => import('./AccountCheckExecutionList.vue') }, { title: this.$t('DetectEngines'), name: 'AccountCheckEngine', - hidden: !this.$hasPerm('accounts.view_checkaccountautomation'), + hidden: !this.$hasPerm('accounts.view_checkaccountengine'), component: () => import('@/views/accounts/RiskDetect/AccountCheckEngine.vue') } ] diff --git a/src/views/dashboard/Pam/index.vue b/src/views/dashboard/Pam/index.vue index 627d8213e..45382184a 100644 --- a/src/views/dashboard/Pam/index.vue +++ b/src/views/dashboard/Pam/index.vue @@ -1,9 +1,8 @@