perf: Add viewAssetOnlineSessionInfo conf

This commit is contained in:
wangruidong
2024-11-25 14:48:26 +08:00
committed by Bryan
parent 01b8c1f7a8
commit 04ec34364f
6 changed files with 85 additions and 57 deletions

View File

@@ -3,6 +3,7 @@
import os
import tarfile
from django.conf import settings
from django.core.files.storage import default_storage
from django.db.models import F
from django.http import FileResponse
@@ -160,6 +161,8 @@ class SessionViewSet(RecordViewLogMixin, OrgBulkModelViewSet):
@action(methods=[GET], detail=False, permission_classes=[IsAuthenticated], url_path='online-info', )
def online_info(self, request, *args, **kwargs):
if not settings.VIEW_ASSET_ONLINE_SESSION_INFO:
return self.permission_denied(request, "view asset online session info disabled")
asset = self.request.query_params.get('asset_id')
account = self.request.query_params.get('account')
if asset is None or account is None: