From 63f828da0b5da6f6d36c8f5b283eb1ceb65b013f Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Wed, 9 Oct 2024 14:55:34 +0800 Subject: [PATCH] perf: Default endpoint cannot be disabled --- apps/terminal/serializers/endpoint.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/terminal/serializers/endpoint.py b/apps/terminal/serializers/endpoint.py index dbaf482e8..c0e236195 100644 --- a/apps/terminal/serializers/endpoint.py +++ b/apps/terminal/serializers/endpoint.py @@ -58,6 +58,13 @@ class EndpointSerializer(BulkModelSerializer): extra_kwargs[field.name] = kwargs return extra_kwargs + def validate_is_active(self, value): + if str(self.instance.id) == Endpoint.default_id: + # 默认端点不能禁用 + return True + else: + return value + class EndpointRuleSerializer(BulkModelSerializer): _ip_group_help_text = '{}, {}
{}'.format(