fix(assets): 修复系统用户导入模版没有密码字段的问题

pull/4744/head v2.2.3
Bai 2020-09-14 11:38:48 +08:00 committed by 老广
parent 9060b49dcb
commit fdcecb022d
1 changed files with 7 additions and 0 deletions

View File

@ -149,6 +149,7 @@ class SystemUserListSerializer(SystemUserSerializer):
class Meta(SystemUserSerializer.Meta):
fields = [
'id', 'name', 'username', 'protocol',
'password', 'public_key', 'private_key',
'login_mode', 'login_mode_display',
'priority', "username_same_with_user",
'auto_push', 'sudo', 'shell', 'comment',
@ -157,6 +158,12 @@ class SystemUserListSerializer(SystemUserSerializer):
'sftp_root',
]
extra_kwargs = {
'password': {"write_only": True},
'public_key': {"write_only": True},
'private_key': {"write_only": True},
}
@classmethod
def setup_eager_loading(cls, queryset):
""" Perform necessary eager loading of data. """