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
bb9a0672
Commit
bb9a0672
authored
Oct 18, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish command log
parent
961abad1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
api.py
apps/audits/api.py
+4
-2
models.py
apps/audits/models.py
+3
-3
serializers.py
apps/audits/serializers.py
+1
-2
No files found.
apps/audits/api.py
View file @
bb9a0672
...
...
@@ -6,7 +6,7 @@ from rest_framework import generics
import
serializers
from
.models
import
ProxyLog
from
.models
import
ProxyLog
,
CommandLog
from
.hands
import
IsSuperUserOrTerminalUser
,
Terminal
...
...
@@ -45,5 +45,7 @@ class ProxyLogDetailApi(generics.RetrieveUpdateDestroyAPIView):
permission_classes
=
(
IsSuperUserOrTerminalUser
,)
class
CommandLogCreateApi
(
generics
.
CreateAPIView
):
class
CommandLogCreateApi
(
generics
.
ListCreateAPIView
):
queryset
=
CommandLog
.
objects
.
all
()
serializer_class
=
serializers
.
CommandLogSerializer
permission_classes
=
(
IsSuperUserOrTerminalUser
,)
apps/audits/models.py
View file @
bb9a0672
...
...
@@ -60,14 +60,14 @@ class ProxyLog(models.Model):
class
CommandLog
(
models
.
Model
):
proxy_log
=
models
.
ForeignKey
(
ProxyLog
,
on_delete
=
models
.
CASCADE
,
related_name
=
'command_log'
)
command_no
=
models
.
IntegerField
()
command
=
models
.
CharField
(
max_length
=
1000
,
blank
=
True
)
output
=
models
.
TextField
(
blank
=
True
)
date_start
=
models
.
DateTimeField
(
null
=
True
)
date_finished
=
models
.
DateTimeField
(
null
=
True
)
datetime
=
models
.
DateTimeField
(
null
=
True
)
def
__unicode__
(
self
):
return
'
%
s:
%
s'
%
(
self
.
id
,
self
.
command
)
class
Meta
:
db_table
=
'command_log'
ordering
=
[
'
-date_start
'
,
'command'
]
ordering
=
[
'
command_no
'
,
'command'
]
apps/audits/serializers.py
View file @
bb9a0672
...
...
@@ -16,5 +16,4 @@ class CommandLogSerializer(serializers.ModelSerializer):
model
=
models
.
CommandLog
if
__name__
==
'__main__'
:
pass
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