fix: 修复客户端方式访问资产 Endpoint 标签匹配策略不生效的问题

pull/11022/head
Bai 1 year ago committed by Bryan
parent 947c9e6216
commit 47195e2c44

@ -23,7 +23,7 @@ from common.utils.http import is_true, is_false
from orgs.mixins.api import RootOrgViewMixin from orgs.mixins.api import RootOrgViewMixin
from perms.models import ActionChoices from perms.models import ActionChoices
from terminal.connect_methods import NativeClient, ConnectMethodUtil from terminal.connect_methods import NativeClient, ConnectMethodUtil
from terminal.models import EndpointRule from terminal.models import EndpointRule, Endpoint
from ..models import ConnectionToken, date_expired_default from ..models import ConnectionToken, date_expired_default
from ..serializers import ( from ..serializers import (
ConnectionTokenSerializer, ConnectionTokenSecretSerializer, ConnectionTokenSerializer, ConnectionTokenSecretSerializer,
@ -166,6 +166,8 @@ class RDPFileClientProtocolURLMixin:
return data return data
def get_smart_endpoint(self, protocol, asset=None): def get_smart_endpoint(self, protocol, asset=None):
endpoint = Endpoint.match_by_instance_label(asset, protocol)
if not endpoint:
target_ip = asset.get_target_ip() if asset else '' target_ip = asset.get_target_ip() if asset else ''
endpoint = EndpointRule.match_endpoint( endpoint = EndpointRule.match_endpoint(
target_instance=asset, target_ip=target_ip, target_instance=asset, target_ip=target_ip,

Loading…
Cancel
Save