mirror of https://github.com/jumpserver/jumpserver
commit
4d7f8ffc71
|
@ -43,7 +43,7 @@ __all__ = [
|
||||||
class NodeViewSet(SuggestionMixin, OrgBulkModelViewSet):
|
class NodeViewSet(SuggestionMixin, OrgBulkModelViewSet):
|
||||||
model = Node
|
model = Node
|
||||||
filterset_fields = ('value', 'key', 'id')
|
filterset_fields = ('value', 'key', 'id')
|
||||||
search_fields = ('value',)
|
search_fields = ('full_value',)
|
||||||
serializer_class = serializers.NodeSerializer
|
serializer_class = serializers.NodeSerializer
|
||||||
rbac_perms = {
|
rbac_perms = {
|
||||||
'match': 'assets.match_node',
|
'match': 'assets.match_node',
|
||||||
|
|
|
@ -91,6 +91,11 @@ class ConnectionTokenMixin:
|
||||||
"config": rdp_config
|
"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):
|
def get_rdp_file_info(self, token: ConnectionToken):
|
||||||
rdp_options = {
|
rdp_options = {
|
||||||
'full address:s': '',
|
'full address:s': '',
|
||||||
|
@ -140,7 +145,9 @@ class ConnectionTokenMixin:
|
||||||
endpoint = self.get_smart_endpoint(
|
endpoint = self.get_smart_endpoint(
|
||||||
protocol='rdp', asset=token.asset, application=token.application
|
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))
|
rdp_options['username:s'] = '{}|{}'.format(token.user.username, str(token.id))
|
||||||
|
@ -192,8 +199,10 @@ class ConnectionTokenMixin:
|
||||||
endpoint = self.get_smart_endpoint(
|
endpoint = self.get_smart_endpoint(
|
||||||
protocol='ssh', asset=token.asset, application=token.application
|
protocol='ssh', asset=token.asset, application=token.application
|
||||||
)
|
)
|
||||||
|
# TODO 暂时获取一下host,后续优化
|
||||||
|
host = self.get_host(endpoint)
|
||||||
data = {
|
data = {
|
||||||
'ip': endpoint.host,
|
'ip': host,
|
||||||
'port': str(endpoint.ssh_port),
|
'port': str(endpoint.ssh_port),
|
||||||
'username': 'JMS-{}'.format(str(token.id)),
|
'username': 'JMS-{}'.format(str(token.id)),
|
||||||
'password': token.secret
|
'password': token.secret
|
||||||
|
|
|
@ -4959,7 +4959,7 @@ msgstr "リンク期限切れ"
|
||||||
|
|
||||||
#: terminal/models/sharing.py:68
|
#: terminal/models/sharing.py:68
|
||||||
msgid "User not allowed to join"
|
msgid "User not allowed to join"
|
||||||
msgstr "IPは許可されていません"
|
msgstr "ユーザーはセッションに参加できません"
|
||||||
|
|
||||||
#: terminal/models/sharing.py:85 terminal/serializers/sharing.py:59
|
#: terminal/models/sharing.py:85 terminal/serializers/sharing.py:59
|
||||||
msgid "Joiner"
|
msgid "Joiner"
|
||||||
|
|
|
@ -4883,7 +4883,7 @@ msgstr "链接过期"
|
||||||
|
|
||||||
#: terminal/models/sharing.py:68
|
#: terminal/models/sharing.py:68
|
||||||
msgid "User not allowed to join"
|
msgid "User not allowed to join"
|
||||||
msgstr "来源 IP 不被允许登录"
|
msgstr "该用户无权加入会话"
|
||||||
|
|
||||||
#: terminal/models/sharing.py:85 terminal/serializers/sharing.py:59
|
#: terminal/models/sharing.py:85 terminal/serializers/sharing.py:59
|
||||||
msgid "Joiner"
|
msgid "Joiner"
|
||||||
|
|
|
@ -43,6 +43,8 @@ class SessionSharing(CommonModelMixin, OrgModelMixin):
|
||||||
return 'Creator: {}'.format(self.creator)
|
return 'Creator: {}'.format(self.creator)
|
||||||
|
|
||||||
def users_display(self):
|
def users_display(self):
|
||||||
|
if not self.users:
|
||||||
|
return []
|
||||||
with tmp_to_root_org():
|
with tmp_to_root_org():
|
||||||
user_ids = self.users.split(',')
|
user_ids = self.users.split(',')
|
||||||
users = User.objects.filter(id__in=user_ids)
|
users = User.objects.filter(id__in=user_ids)
|
||||||
|
|
|
@ -62,7 +62,7 @@ jsonfield2==4.0.0.post0
|
||||||
geoip2==4.5.0
|
geoip2==4.5.0
|
||||||
ipip-ipdb==1.6.1
|
ipip-ipdb==1.6.1
|
||||||
# Django environment
|
# Django environment
|
||||||
Django==3.2.14
|
Django==3.2.13
|
||||||
django-bootstrap3==14.2.0
|
django-bootstrap3==14.2.0
|
||||||
django-filter==2.4.0
|
django-filter==2.4.0
|
||||||
django-formtools==2.2
|
django-formtools==2.2
|
||||||
|
|
Loading…
Reference in New Issue