mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-31 15:11:27 +00:00
perf: 添加lion终端类型; 修改加入会话校验逻辑(vnc/rdp)
This commit is contained in:
@@ -90,7 +90,7 @@ class SessionViewSet(OrgBulkModelViewSet):
|
||||
|
||||
def filter_queryset(self, queryset):
|
||||
queryset = super().filter_queryset(queryset)
|
||||
# 解决guacamole更新session时并发导致幽灵会话的问题
|
||||
# 解决guacamole更新session时并发导致幽灵会话的问题,暂不处理
|
||||
if self.request.method in ('PATCH',):
|
||||
queryset = queryset.select_for_update()
|
||||
return queryset
|
||||
@@ -98,11 +98,6 @@ class SessionViewSet(OrgBulkModelViewSet):
|
||||
def perform_create(self, serializer):
|
||||
if hasattr(self.request.user, 'terminal'):
|
||||
serializer.validated_data["terminal"] = self.request.user.terminal
|
||||
sid = serializer.validated_data["system_user"]
|
||||
# guacamole提交的是id
|
||||
if is_uuid(sid):
|
||||
_system_user = get_object_or_404(SystemUser, id=sid)
|
||||
serializer.validated_data["system_user"] = _system_user.name
|
||||
return super().perform_create(serializer)
|
||||
|
||||
def get_permissions(self):
|
||||
@@ -140,6 +135,7 @@ class SessionReplayViewSet(AsyncApiMixin, viewsets.ViewSet):
|
||||
def get_replay_data(session, url):
|
||||
tp = 'json'
|
||||
if session.protocol in ('rdp', 'vnc'):
|
||||
# 需要考虑录像播放和离线播放器的约定,暂时不处理
|
||||
tp = 'guacamole'
|
||||
|
||||
download_url = reverse('api-terminal:session-replay-download', kwargs={'pk': session.id})
|
||||
|
@@ -39,11 +39,6 @@ class StatusViewSet(viewsets.ModelViewSet):
|
||||
|
||||
def handle_sessions(self):
|
||||
session_ids = self.request.data.get('sessions', [])
|
||||
# guacamole 上报的 session 是字符串
|
||||
# "[53cd3e47-210f-41d8-b3c6-a184f3, 53cd3e47-210f-41d8-b3c6-a184f4]"
|
||||
if isinstance(session_ids, str):
|
||||
session_ids = session_ids[1:-1].split(',')
|
||||
session_ids = [sid.strip() for sid in session_ids if sid.strip()]
|
||||
Session.set_sessions_active(session_ids)
|
||||
|
||||
def get_queryset(self):
|
||||
|
Reference in New Issue
Block a user