提交 4468e2d3 编写于 作者: baltery's avatar baltery

feat: 限制gateway 仅有ssh协议

上级 9362c272
......@@ -41,6 +41,16 @@ class GatewaySerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer):
'date_updated', 'created_by', 'comment',
]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.protocol_limit_to_ssh()
def protocol_limit_to_ssh(self):
protocol_field = self.fields['protocol']
choices = protocol_field.choices
choices.pop('rdp')
protocol_field._choices = choices
class GatewayWithAuthSerializer(GatewaySerializer):
def get_field_names(self, declared_fields, info):
......@@ -51,6 +61,8 @@ class GatewayWithAuthSerializer(GatewaySerializer):
return fields
class DomainWithGatewaySerializer(BulkOrgResourceModelSerializer):
gateways = GatewayWithAuthSerializer(many=True, read_only=True)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册