From a59f1895a3d9ac89ac0469daf0d4bc78671e85ed Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Wed, 12 Apr 2023 11:43:06 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=BD=93=E8=BF=9E=E6=8E=A5=E8=B5=84?= =?UTF-8?q?=E4=BA=A7=E4=B8=BA=E7=BD=91=E5=85=B3=E6=97=B6=EF=BC=8Cconnectio?= =?UTF-8?q?n=5Ftoken=E4=B8=8D=E8=BF=94=E5=9B=9E=E7=BD=91=E5=9F=9F=E7=BD=91?= =?UTF-8?q?=E5=85=B3=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/models/connection_token.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/authentication/models/connection_token.py b/apps/authentication/models/connection_token.py index 6a69a7e37..63049170b 100644 --- a/apps/authentication/models/connection_token.py +++ b/apps/authentication/models/connection_token.py @@ -10,6 +10,7 @@ from django.utils.translation import ugettext_lazy as _ from rest_framework.exceptions import PermissionDenied from assets.const import Protocol +from assets.const.host import GATEWAY_NAME from common.db.fields import EncryptTextField from common.exceptions import JMSException from common.utils import lazyproperty, pretty_string, bulk_get @@ -231,12 +232,14 @@ class ConnectionToken(JMSOrgBaseModel): def domain(self): if not self.asset.platform.domain_enabled: return - domain = self.asset.domain if self.asset else None + if self.asset.platform.name == GATEWAY_NAME: + return + domain = self.asset.domain if self.asset.domain else None return domain @lazyproperty def gateway(self): - if not self.asset: + if not self.asset or not self.domain: return return self.asset.gateway