diff --git a/apps/assets/api/node.py b/apps/assets/api/node.py index 3d5d22178..2bb77b60c 100644 --- a/apps/assets/api/node.py +++ b/apps/assets/api/node.py @@ -43,7 +43,7 @@ __all__ = [ class NodeViewSet(SuggestionMixin, OrgBulkModelViewSet): model = Node filterset_fields = ('value', 'key', 'id') - search_fields = ('value',) + search_fields = ('full_value',) serializer_class = serializers.NodeSerializer rbac_perms = { 'match': 'assets.match_node', diff --git a/apps/authentication/api/connection_token.py b/apps/authentication/api/connection_token.py index f0a7e0a63..60b91e4db 100644 --- a/apps/authentication/api/connection_token.py +++ b/apps/authentication/api/connection_token.py @@ -91,6 +91,11 @@ class ConnectionTokenMixin: "config": rdp_config } + def get_host(self, endpoint): + if not endpoint.host: + return self.request.get_host() + return endpoint.host + def get_rdp_file_info(self, token: ConnectionToken): rdp_options = { 'full address:s': '', @@ -140,7 +145,9 @@ class ConnectionTokenMixin: endpoint = self.get_smart_endpoint( protocol='rdp', asset=token.asset, application=token.application ) - rdp_options['full address:s'] = f'{endpoint.host}:{endpoint.rdp_port}' + # TODO 暂时获取一下host,后续优化 + host = self.get_host(endpoint) + rdp_options['full address:s'] = f'{host}:{endpoint.rdp_port}' # 设置用户名 rdp_options['username:s'] = '{}|{}'.format(token.user.username, str(token.id)) @@ -192,8 +199,10 @@ class ConnectionTokenMixin: endpoint = self.get_smart_endpoint( protocol='ssh', asset=token.asset, application=token.application ) + # TODO 暂时获取一下host,后续优化 + host = self.get_host(endpoint) data = { - 'ip': endpoint.host, + 'ip': host, 'port': str(endpoint.ssh_port), 'username': 'JMS-{}'.format(str(token.id)), 'password': token.secret diff --git a/apps/locale/ja/LC_MESSAGES/django.po b/apps/locale/ja/LC_MESSAGES/django.po index 1ade4540a..54c5c70f0 100644 --- a/apps/locale/ja/LC_MESSAGES/django.po +++ b/apps/locale/ja/LC_MESSAGES/django.po @@ -4959,7 +4959,7 @@ msgstr "リンク期限切れ" #: terminal/models/sharing.py:68 msgid "User not allowed to join" -msgstr "IPは許可されていません" +msgstr "ユーザーはセッションに参加できません" #: terminal/models/sharing.py:85 terminal/serializers/sharing.py:59 msgid "Joiner" diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 6f50d5c61..15cb33b57 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -4883,7 +4883,7 @@ msgstr "链接过期" #: terminal/models/sharing.py:68 msgid "User not allowed to join" -msgstr "来源 IP 不被允许登录" +msgstr "该用户无权加入会话" #: terminal/models/sharing.py:85 terminal/serializers/sharing.py:59 msgid "Joiner" diff --git a/apps/terminal/models/sharing.py b/apps/terminal/models/sharing.py index 6976b09cf..8675ced01 100644 --- a/apps/terminal/models/sharing.py +++ b/apps/terminal/models/sharing.py @@ -43,6 +43,8 @@ class SessionSharing(CommonModelMixin, OrgModelMixin): return 'Creator: {}'.format(self.creator) def users_display(self): + if not self.users: + return [] with tmp_to_root_org(): user_ids = self.users.split(',') users = User.objects.filter(id__in=user_ids) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 75e397656..afe9b7179 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -62,7 +62,7 @@ jsonfield2==4.0.0.post0 geoip2==4.5.0 ipip-ipdb==1.6.1 # Django environment -Django==3.2.14 +Django==3.2.13 django-bootstrap3==14.2.0 django-filter==2.4.0 django-formtools==2.2