perf: 优化用户列表和用户创建的角色 (#291)

* perf: 优化用户角色

Closes https://github.com/orgs/jumpserver/projects/1

* perf: 优化用户角色

Closes https://github.com/orgs/jumpserver/projects/1

Co-authored-by: OrangeM21 <orangemtony@gmail.com>
This commit is contained in:
fit2bot 2020-08-11 11:06:22 +08:00 committed by GitHub
parent 8f00dbf23e
commit 62a6d11332
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 5 deletions

View File

@ -794,6 +794,8 @@
"ResetAndDownloadSSHKey": "重置并下载密钥",
"ResetPublicKeyAndDownload": "重置并下载SSH密钥",
"Role": "角色",
"SuperRole": "超级角色",
"OrgRole": "组织角色",
"SSHKey": "SSH公钥",
"SSHKeySetting": "SSH公钥设置",
"Secure": "安全",

View File

@ -791,6 +791,8 @@
"ResetAndDownloadSSHKey": "Reset and download SSH Key",
"ResetPublicKeyAndDownload": "Reset public key and download",
"Role": "Role",
"SuperRole": "Super role",
"OrgRole": "Org role",
"SSHKey": "SSH Key",
"SSHKeySetting": "SSH Key setting",
"Secure": "Secure",

View File

@ -9,6 +9,7 @@
import { GenericCreateUpdatePage } from '@/layout/components'
import UserPassword from '@/components/UserPassword'
import { getDayFuture } from '@/utils/common'
import { mapGetters } from 'vuex'
export default {
components: {
@ -21,12 +22,13 @@ export default {
mfa_level: 0,
source: 'local',
role: 'User',
org_role: 'User',
date_expired: getDayFuture(36500, new Date()).toISOString()
},
fields: [
[this.$t('users.Account'), ['name', 'username', 'email', 'groups']],
[this.$t('users.Authentication'), ['password_strategy', 'update_password', 'password', 'set_public_key', 'public_key', 'mfa_level', 'source']],
[this.$t('users.Secure'), ['role', 'date_expired']],
[this.$t('users.Secure'), ['role', 'org_role', 'date_expired']],
[this.$t('common.Other'), ['phone', 'wechat', 'comment']]
],
url: '/api/v1/users/users/',
@ -73,6 +75,18 @@ export default {
return !formValue.set_public_key
}
},
role: {
label: this.$t('users.SuperRole')
},
org_role: {
label: this.$t('users.OrgRole'),
hidden: () => {
return !this.publicSettings.XPACK_LICENSE_IS_VALID
},
el: {
// disabled: () => this.currentOrgIsDefault
}
},
groups: {
el: {
multiple: true,
@ -85,6 +99,12 @@ export default {
}
}
},
computed: {
...mapGetters(['publicSettings', 'currentOrg']),
currentOrgIsDefault() {
return this.currentOrg.id === 'DEFAULT' || this.currentOrg.id === ''
}
},
methods: {
cleanFormValue(value) {
const method = this.getMethod()

View File

@ -27,7 +27,7 @@ export default {
tableConfig: {
url: '/api/v1/users/users/',
columns: [
'name', 'username', 'groups_display', 'role', 'source', 'is_valid', 'actions'
'name', 'username', 'groups_display', 'total_role_display', 'source', 'is_valid', 'actions'
],
columnsMeta: {
username: {
@ -36,9 +36,9 @@ export default {
source: {
width: '120px'
},
// role: {
// width: '100px'
// },
total_role_display: {
label: this.$t('users.Role')
},
groups_display: {
width: '200px',
showOverflowTooltip: true