2018-02-07 15:25:15 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
2021-07-08 06:23:18 +00:00
|
|
|
from ..models import SystemUser
|
2021-07-14 08:22:27 +00:00
|
|
|
from .system_user import SystemUserSerializer as SuS
|
2018-03-27 10:34:41 +00:00
|
|
|
|
2018-02-07 15:25:15 +00:00
|
|
|
|
2021-07-14 08:22:27 +00:00
|
|
|
class AdminUserSerializer(SuS):
|
2018-02-07 15:25:15 +00:00
|
|
|
"""
|
|
|
|
管理用户
|
|
|
|
"""
|
|
|
|
|
2021-07-14 08:22:27 +00:00
|
|
|
class Meta(SuS.Meta):
|
|
|
|
fields = SuS.Meta.fields_mini + \
|
|
|
|
SuS.Meta.fields_write_only + \
|
|
|
|
SuS.Meta.fields_m2m + \
|
|
|
|
[
|
|
|
|
'type', 'protocol', "priority", 'sftp_root', 'ssh_key_fingerprint',
|
2022-03-28 11:48:55 +00:00
|
|
|
'su_enabled', 'su_from',
|
2021-07-14 08:22:27 +00:00
|
|
|
'date_created', 'date_updated', 'comment', 'created_by',
|
|
|
|
]
|
2019-05-21 08:24:01 +00:00
|
|
|
|
2021-07-14 08:22:27 +00:00
|
|
|
def validate_type(self, val):
|
|
|
|
return SystemUser.Type.admin
|
2018-02-07 15:25:15 +00:00
|
|
|
|
2021-07-14 08:22:27 +00:00
|
|
|
def validate_protocol(self, val):
|
|
|
|
return 'ssh'
|