fix: 修复角色更新、删除权限控制

This commit is contained in:
Jiangjie.Bai
2022-03-18 14:49:03 +08:00
committed by huailei
parent 3a1870cae1
commit 4db98964dd
4 changed files with 10 additions and 11 deletions

View File

@@ -31,6 +31,7 @@ export default {
return {
loading: true,
relationConfig: {
disabled: !this.$hasPerm('rbac.add_systemrolebinding'),
icon: 'fa-user',
title: this.$t('common.Members'),
objectsAjax: {

View File

@@ -36,10 +36,10 @@ export default {
activeMenu: 'RoleInfo',
actions: {
canDelete: () => {
return vm.hasPermNotBuiltinNotRootOrg(this.role, `rbac.delete_${scopeRole}`)
return vm.hasPermNotBuiltin(this.role, `rbac.delete_${scopeRole}`)
},
canUpdate: () => {
return vm.hasPermNotBuiltinNotRootOrg(this.role, `rbac.change_${scopeRole}`)
return vm.hasPermNotBuiltin(this.role, `rbac.change_${scopeRole}`)
},
updateRoute: {
name: this.$route.name.replace('Detail', 'Update'),
@@ -62,10 +62,8 @@ export default {
}
},
methods: {
hasPermNotBuiltinNotRootOrg(row, perm) {
return !row['builtin'] &&
this.$hasPerm(perm) &&
!this.$isRootOrg()
hasPermNotBuiltin(row, perm) {
return !row['builtin'] && this.$hasPerm(perm)
}
}
}

View File

@@ -60,10 +60,10 @@ export default {
actions: {
formatterArgs: {
canUpdate: ({ row }) => {
return this.hasPermNotBuiltinNotRootOrg(row, `rbac.change_${row.scope}role`)
return this.hasPermNotBuiltin(row, `rbac.change_${row.scope}role`)
},
canDelete: ({ row }) => {
return this.hasPermNotBuiltinNotRootOrg(row, `rbac.delete_${row.scope}role`)
return this.hasPermNotBuiltin(row, `rbac.delete_${row.scope}role`)
},
updateRoute: {
name: 'RoleUpdate',
@@ -108,8 +108,8 @@ export default {
}
},
methods: {
hasPermNotBuiltinNotRootOrg(row, perm) {
return !row['builtin'] && this.$hasPerm(perm) && !this.$isRootOrg()
hasPermNotBuiltin(row, perm) {
return !row['builtin'] && this.$hasPerm(perm)
}
}
}

View File

@@ -116,7 +116,7 @@ export default {
}
},
hidden: () => {
return !this.$hasPerm('rbac.change_systemrolebinding')
return !this.$hasPerm('rbac.add_systemrolebinding')
},
value: []
},