mirror of https://github.com/jumpserver/jumpserver
Update api
parent
ea3f8af161
commit
0d4d64c274
|
@ -3,14 +3,14 @@
|
|||
|
||||
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
from rest_framework import generics
|
||||
from rest_framework import generics, viewsets
|
||||
from rest_framework.views import APIView, Response
|
||||
|
||||
from . import models, serializers
|
||||
from .hands import IsSuperUserOrTerminalUser, Terminal
|
||||
|
||||
|
||||
class ProxyLogListCreateApi(generics.ListCreateAPIView):
|
||||
class ProxyLogViewSet(viewsets.ModelViewSet):
|
||||
"""User proxy to backend server need call this api.
|
||||
|
||||
params: {
|
||||
|
@ -34,18 +34,8 @@ class ProxyLogListCreateApi(generics.ListCreateAPIView):
|
|||
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 = models.ProxyLog.objects.all()
|
||||
serializer_class = serializers.ProxyLogSerializer
|
||||
permission_classes = (IsSuperUserOrTerminalUser,)
|
||||
|
||||
|
||||
class CommandLogListCreateApi(generics.ListCreateAPIView):
|
||||
class CommandLogViewSet(viewsets.ModelViewSet):
|
||||
queryset = models.CommandLog.objects.all()
|
||||
serializer_class = serializers.CommandLogSerializer
|
||||
permission_classes = (IsSuperUserOrTerminalUser,)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from django.conf.urls import url
|
||||
|
||||
from rest_framework import routers
|
||||
|
||||
import api
|
||||
import views
|
||||
|
@ -13,9 +14,8 @@ urlpatterns = [
|
|||
url(r'^command-log$', views.CommandLogListView.as_view(), name='command-log-list'),
|
||||
]
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register(r'v1/proxy-log', api.ProxyLogViewSet, 'api-proxy-log')
|
||||
router.register(r'v1/command-log', api.CommandLogViewSet, 'api-command-log')
|
||||
|
||||
urlpatterns += [
|
||||
url(r'^v1/proxy-log/$', api.ProxyLogListCreateApi.as_view(), name='proxy-log-list-create-api'),
|
||||
url(r'^v1/proxy-log/(?P<pk>\d+)/$', api.ProxyLogDetailApi.as_view(), name='proxy-log-detail-api'),
|
||||
url(r'^v1/command-log/$', api.CommandLogListCreateApi.as_view(), name='command-log-create-list-api'),
|
||||
]
|
||||
urlpatterns += router.urls
|
||||
|
|
Loading…
Reference in New Issue