From d62a4ca36ea9d79ae25eb8731d74f1277a973faf Mon Sep 17 00:00:00 2001 From: Michael Bai Date: Thu, 4 Nov 2021 16:29:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=94=A8=E6=88=B7su=5Fenabled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SystemUserCreateUpdate/CommonUser/ssh.vue | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/views/assets/SystemUser/SystemUserCreateUpdate/CommonUser/ssh.vue b/src/views/assets/SystemUser/SystemUserCreateUpdate/CommonUser/ssh.vue index 6804c9df5..ff144b817 100644 --- a/src/views/assets/SystemUser/SystemUserCreateUpdate/CommonUser/ssh.vue +++ b/src/views/assets/SystemUser/SystemUserCreateUpdate/CommonUser/ssh.vue @@ -34,6 +34,7 @@ export default { [this.$t('common.Auth'), ['login_mode', 'auto_generate_key', 'password', 'private_key']], [this.$t('assets.AutoPush'), ['auto_push', 'sudo', 'shell', 'home', 'system_groups']], [this.$t('common.Command filter'), ['cmd_filters']], + [this.$t('assets.SwitchUser'), ['su_enabled', 'su_from']], [this.$t('common.Other'), ['priority', 'sftp_root', 'comment']] ], fieldsMeta: { @@ -64,7 +65,24 @@ export default { hidden: (item) => item.protocol !== 'ssh' || !item.auto_push || item.username_same_with_user, helpText: this.$t('assets.HomeHelpMessage') }, - system_groups: fields.system_groups + system_groups: fields.system_groups, + su_enabled: { + type: 'switch', + hidden: (item) => item.protocol !== 'ssh' + }, + su_from: { + hidden: (item) => !item.su_enabled, + el: { + multiple: false, + clearable: true, + ajax: { + url: '/api/v1/assets/system-users/su-from/', + transformOption: (item) => { + return { label: item.name + '(' + item.username + ')', value: item.id } + } + } + } + } }, url: '/api/v1/assets/system-users/' }