mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-09 01:58:42 +00:00
feat: 限制gateway 仅有ssh协议
This commit is contained in:
parent
9362c272cb
commit
4468e2d379
@ -41,6 +41,16 @@ class GatewaySerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer):
|
|||||||
'date_updated', 'created_by', 'comment',
|
'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):
|
class GatewayWithAuthSerializer(GatewaySerializer):
|
||||||
def get_field_names(self, declared_fields, info):
|
def get_field_names(self, declared_fields, info):
|
||||||
@ -51,6 +61,8 @@ class GatewayWithAuthSerializer(GatewaySerializer):
|
|||||||
return fields
|
return fields
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DomainWithGatewaySerializer(BulkOrgResourceModelSerializer):
|
class DomainWithGatewaySerializer(BulkOrgResourceModelSerializer):
|
||||||
gateways = GatewayWithAuthSerializer(many=True, read_only=True)
|
gateways = GatewayWithAuthSerializer(many=True, read_only=True)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user