mirror of https://github.com/jumpserver/jumpserver
fix: 修复组件在线会话数量不对的问题
parent
e2d5b69510
commit
fdb8416cac
|
@ -7,6 +7,7 @@ from django.conf import settings
|
||||||
|
|
||||||
from common.utils import get_logger
|
from common.utils import get_logger
|
||||||
from users.models import User
|
from users.models import User
|
||||||
|
from orgs.utils import tmp_to_root_org
|
||||||
from .status import Status
|
from .status import Status
|
||||||
from .. import const
|
from .. import const
|
||||||
from ..const import ComponentStatusChoices as StatusChoice
|
from ..const import ComponentStatusChoices as StatusChoice
|
||||||
|
@ -112,7 +113,6 @@ class Terminal(StorageMixin, TerminalStatusMixin, models.Model):
|
||||||
date_created = models.DateTimeField(auto_now_add=True)
|
date_created = models.DateTimeField(auto_now_add=True)
|
||||||
comment = models.TextField(blank=True, verbose_name=_('Comment'))
|
comment = models.TextField(blank=True, verbose_name=_('Comment'))
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_active(self):
|
def is_active(self):
|
||||||
if self.user and self.user.is_active:
|
if self.user and self.user.is_active:
|
||||||
|
@ -126,6 +126,7 @@ class Terminal(StorageMixin, TerminalStatusMixin, models.Model):
|
||||||
self.user.save()
|
self.user.save()
|
||||||
|
|
||||||
def get_online_sessions(self):
|
def get_online_sessions(self):
|
||||||
|
with tmp_to_root_org():
|
||||||
return Session.objects.filter(terminal=self, is_finished=False)
|
return Session.objects.filter(terminal=self, is_finished=False)
|
||||||
|
|
||||||
def get_online_session_count(self):
|
def get_online_session_count(self):
|
||||||
|
|
Loading…
Reference in New Issue