fix: 修复管理员终断会话API

pull/7687/head
Eric 2022-02-23 17:09:09 +08:00
parent e76eec530f
commit a1d15ef206
1 changed files with 5 additions and 2 deletions

View File

@ -12,7 +12,6 @@ from .. import serializers
from terminal.utils import is_session_approver
from orgs.utils import tmp_to_root_org
__all__ = ['TaskViewSet', 'KillSessionAPI', 'KillSessionForTicketAPI']
logger = logging.getLogger(__file__)
@ -45,6 +44,11 @@ class KillSessionAPI(APIView):
'POST': 'terminal.terminate_session'
}
def post(self, request, *args, **kwargs):
session_ids = request.data
validated_session = kill_sessions(session_ids, request.user)
return Response({"ok": validated_session})
class KillSessionForTicketAPI(APIView):
permission_classes = (IsAuthenticated, )
@ -61,4 +65,3 @@ class KillSessionForTicketAPI(APIView):
validated_session = kill_sessions(session_ids, request.user)
return Response({"ok": validated_session})