diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index 055e5586a..cc5480091 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -792,6 +792,9 @@ "OrgUser": "组织用户", "OrgAdmin": "组织管理员", "OrgAuditor": "组织审计员", + "InviteUser": "邀请用户", + "Invite": "邀请", + "InviteUserInOrg": "邀请用户加入此组织", "Guide": "向导", "HelpText": { "MFAOfUserFirstLoginPersonalInformationImprovementPage": "启用多因子认证,使账号更加安全。
启用之后您将会在下次登录时进入多因子认证绑定流程;您也可以在(个人信息->快速修改->更改多因子设置)中直接绑定!", diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index c97eae36d..43564eb5f 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -787,10 +787,14 @@ "Email": "Email", "FingerPrint": "Fingerprint", "FirstLogin": "First login", + "InviteUser": "Invite user", + "InviteUserInOrg": "Invite user in this org", + "Invite": "Invite", "Guide": "Guide", "OrgUser": "Org User", "OrgAdmin": "Org Admin", "OrgAuditor": "Org Auditor", + "HelpText": { "MFAOfUserFirstLoginPersonalInformationImprovementPage": "Enable multi-factor authentication to make the account more secure
After is enabled, you will enter the multi-factor authentication binding process on your next login
You can also bind directly in (personal information -> fast modifier -> modifier multiple factor Settings)", "MFAOfUserFirstLoginUserGuidePage": "To protect the security of you and the company
please properly keep your account, password, key and other important and sensitive information
(e.g., set a complex password and enable multi-factor authentication)", diff --git a/src/layout/components/GenericListPage/index.vue b/src/layout/components/GenericListPage/index.vue index c922ef6d0..12f31f98e 100644 --- a/src/layout/components/GenericListPage/index.vue +++ b/src/layout/components/GenericListPage/index.vue @@ -1,6 +1,6 @@ diff --git a/src/views/users/User/UserList.vue b/src/views/users/User/UserList.vue index daf3ee0d0..279bc30c5 100644 --- a/src/views/users/User/UserList.vue +++ b/src/views/users/User/UserList.vue @@ -1,11 +1,16 @@ @@ -15,9 +20,11 @@ import { GenericListPage } from '@/layout/components' import { GenericUpdateFormDialog } from '@/layout/components' import { createSourceIdCache } from '@/api/common' import { getDayFuture } from '@/utils/common' +import InviteUsersDialog from '@/views/users/User/components/InviteUsersDialog' export default { components: { + InviteUsersDialog, GenericListPage, GenericUpdateFormDialog }, @@ -27,7 +34,13 @@ export default { tableConfig: { url: '/api/v1/users/users/', columns: [ - 'name', 'username', 'groups_display', 'total_role_display', 'source', 'is_valid', 'actions' + 'name', + 'username', + 'groups_display', + 'total_role_display', + 'source', + 'is_valid', + 'actions' ], columnsMeta: { username: { @@ -70,6 +83,17 @@ export default { }, headerActions: { hasBulkDelete: false, + extraActions: [ + { + name: this.$t('users.InviteUser'), + title: this.$t('users.InviteUser'), + can: + (JSON.parse(this.$cookie.get('jms_current_org')) + ? JSON.parse(this.$cookie.get('jms_current_org')).id + : '') !== 'DEFAULT', + callback: function() { this.InviteDialogSetting.InviteDialogVisible = true }.bind(this) + } + ], extraMoreActions: [ { title: this.$t('common.deleteSelected'), @@ -135,9 +159,7 @@ export default { initial: { date_expired: getDayFuture(36500, new Date()).toISOString() }, - fields: [ - 'groups', 'date_expired', 'comment' - ], + fields: ['groups', 'date_expired', 'comment'], url: '/api/v1/users/users/', fieldsMeta: { groups: { @@ -154,36 +176,36 @@ export default { date_expired: { label: this.$t('common.dateExpired'), hidden: () => false - }, comment: { label: this.$t('common.Comment'), hidden: () => false - } } } + }, + InviteDialogSetting: { + InviteDialogVisible: false } } }, computed: { - ...mapGetters([ - 'currentOrg', - 'currentUser', - 'device' - ]), + ...mapGetters(['currentOrg', 'currentUser', 'device']), currentOrgIsDefault() { return this.currentOrg.id === 'DEFAULT' || this.currentOrg.id === '' } }, mounted() { if (!this.currentOrgIsDefault) { - this.headerActions.extraMoreActions[0].title = this.$t('common.removeSelected') + this.headerActions.extraMoreActions[0].title = this.$t( + 'common.removeSelected' + ) } }, methods: { removeUserFromOrg({ row, col, reload }) { - const msg = this.$t('users.removeFromOrgWarningMsg') + ' "' + row.name + '"' + const msg = + this.$t('users.removeFromOrgWarningMsg') + ' "' + row.name + '"' const title = this.$t('common.Info') const performDelete = function() { const url = `/api/v1/users/users/${row.id}/` @@ -214,7 +236,13 @@ export default { if (!this.currentOrgIsDefault) { msgPrefix = this.$t('common.removeWarningMsg') } - const msg = msgPrefix + ' ' + selectedRows.length + ' ' + this.$t('common.rows') + ' ?' + const msg = + msgPrefix + + ' ' + + selectedRows.length + + ' ' + + this.$t('common.rows') + + ' ?' const title = this.$t('common.Info') const performDelete = this.performBulkDelete this.$alert(msg, title, { @@ -248,17 +276,30 @@ export default { }) }, async performBulkDelete(selectedRows) { - const ids = selectedRows.map((v) => { + const ids = selectedRows.map(v => { return v.id }) const data = await createSourceIdCache(ids) const url = `${this.tableConfig.url}?spm=` + data.spm return this.$axios.delete(url) + }, + handleInviteDialogClose() { + this.InviteDialogSetting.InviteDialogVisible = false + this.$refs.GenericListPage.$refs.ListTable.reloadTable() } } } diff --git a/src/views/users/User/components/InviteUsersDialog.vue b/src/views/users/User/components/InviteUsersDialog.vue new file mode 100644 index 000000000..bb623fd90 --- /dev/null +++ b/src/views/users/User/components/InviteUsersDialog.vue @@ -0,0 +1,154 @@ + + + +