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
4 changed files with 29 additions and 5 deletions

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()