Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
0d4d64c2
Commit
0d4d64c2
authored
Nov 08, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update api
parent
ea3f8af1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
18 deletions
+8
-18
api.py
apps/audits/api.py
+3
-13
urls.py
apps/audits/urls.py
+5
-5
No files found.
apps/audits/api.py
View file @
0d4d64c2
...
...
@@ -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
ProxyLog
ListCreateApi
(
generics
.
ListCreateAPIView
):
class
ProxyLog
ViewSet
(
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
,)
...
...
apps/audits/urls.py
View file @
0d4d64c2
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment