fix: user list perm

This commit is contained in:
feng626
2022-03-04 17:13:48 +08:00
committed by huailei
parent c48e1603b9
commit c8825e52b6
2 changed files with 9 additions and 7 deletions

View File

@@ -108,7 +108,7 @@ export default {
}
},
mounted() {
this.setting.treeUrl = `/api/v1/rbac/roles/${this.object.id}/permissions/tree/`
this.setting.treeUrl = `/api/v1/rbac/${this.object.scope}-roles/${this.object.id}/permissions/tree/`
setTimeout(() => {
this.loading = false
})

View File

@@ -251,14 +251,16 @@ export default {
},
methods: {
setRolesFilter() {
const roleTypes = ['system-roles', 'org-roles']
const roleTypes = [{ name: 'system-roles', perm: 'systemrole' }, { name: 'org-roles', perm: 'orgrole' }]
for (const roleType of roleTypes) {
this.$axios.get(`/api/v1/rbac/${roleType}/`).then((roles) => {
const fieldName = roleType.replace('-', '_')
this.tableConfig.columnsMeta[fieldName].filters = roles.map(r => {
return { text: r['display_name'], value: r.id }
if (this.$hasPerm(`rbac.${roleType.perm}`)) {
this.$axios.get(`/api/v1/rbac/${roleType}/`).then((roles) => {
const fieldName = roleType.name.replace('-', '_')
this.tableConfig.columnsMeta[fieldName].filters = roles.map(r => {
return { text: r['display_name'], value: r.id }
})
})
})
}
}
},
removeUserFromOrg({ row, col, reload }) {