From b2bff223873e2efce3ab26277b7f453b76d5117e Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 21 Jun 2023 12:02:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E4=BC=9A=E8=AF=9D=E6=97=A0=E6=B3=95=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/models/session/session.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/terminal/models/session/session.py b/apps/terminal/models/session/session.py index 5ddd6e647..ccf5936b8 100644 --- a/apps/terminal/models/session/session.py +++ b/apps/terminal/models/session/session.py @@ -10,12 +10,11 @@ from django.db import models from django.utils import timezone from django.utils.translation import ugettext_lazy as _ -from assets.const import Protocol from assets.models import Asset from common.utils import get_object_or_none, lazyproperty from orgs.mixins.models import OrgModelMixin from terminal.backends import get_multi_command_storage -from terminal.const import SessionType +from terminal.const import SessionType, TerminalType from users.models import User @@ -112,6 +111,7 @@ class Session(OrgModelMixin): return rel_path except: pass + @property def asset_obj(self): return Asset.objects.get(id=self.asset_id) @@ -132,10 +132,7 @@ class Session(OrgModelMixin): if self.type != SessionType.normal: # 会话监控仅支持 normal,不支持 tunnel 和 command return False - if self.protocol in [ - Protocol.ssh, Protocol.vnc, Protocol.rdp, - Protocol.telnet, Protocol.k8s - ]: + if self.terminal.type in [TerminalType.lion, TerminalType.koko]: return True else: return False