mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-01-04 23:24:19 +00:00
Add proxy log api
This commit is contained in:
@@ -7,16 +7,42 @@ from rest_framework import generics
|
||||
import serializers
|
||||
|
||||
from .models import ProxyLog
|
||||
from .hands import IsSuperUserOrTerminalUser, Terminal
|
||||
|
||||
|
||||
class ProxyLogListCreateApi(generics.ListCreateAPIView):
|
||||
"""User proxy to backend server need call this api.
|
||||
|
||||
params: {
|
||||
"username": "",
|
||||
"name": "",
|
||||
"hostname": "",
|
||||
"ip": "",
|
||||
"terminal", "",
|
||||
"login_type": "",
|
||||
"system_user": "",
|
||||
"was_failed": "",
|
||||
"date_start": ""
|
||||
}
|
||||
|
||||
some params we need generate: {
|
||||
"log_file", "", # No use now, may be think more about monitor and record
|
||||
}
|
||||
"""
|
||||
|
||||
queryset = ProxyLog.objects.all()
|
||||
serializer_class = serializers.ProxyLogSerializer
|
||||
permission_classes = (IsSuperUserOrTerminalUser,)
|
||||
|
||||
def perform_create(self, serializer):
|
||||
# Todo: May be save log_file
|
||||
super(ProxyLogListCreateApi, self).perform_create(serializer)
|
||||
|
||||
|
||||
class ProxyLogDetailApi(generics.RetrieveUpdateDestroyAPIView):
|
||||
queryset = ProxyLog.objects.all()
|
||||
serializer_class = serializers.ProxyLogSerializer
|
||||
permission_classes = (IsSuperUserOrTerminalUser,)
|
||||
|
||||
|
||||
class CommandLogCreateApi(generics.CreateAPIView):
|
||||
|
||||
Reference in New Issue
Block a user