mirror of https://github.com/jumpserver/jumpserver
Finish command log
parent
961abad14b
commit
bb9a067293
|
@ -6,7 +6,7 @@ from rest_framework import generics
|
||||||
|
|
||||||
import serializers
|
import serializers
|
||||||
|
|
||||||
from .models import ProxyLog
|
from .models import ProxyLog, CommandLog
|
||||||
from .hands import IsSuperUserOrTerminalUser, Terminal
|
from .hands import IsSuperUserOrTerminalUser, Terminal
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,5 +45,7 @@ class ProxyLogDetailApi(generics.RetrieveUpdateDestroyAPIView):
|
||||||
permission_classes = (IsSuperUserOrTerminalUser,)
|
permission_classes = (IsSuperUserOrTerminalUser,)
|
||||||
|
|
||||||
|
|
||||||
class CommandLogCreateApi(generics.CreateAPIView):
|
class CommandLogCreateApi(generics.ListCreateAPIView):
|
||||||
|
queryset = CommandLog.objects.all()
|
||||||
serializer_class = serializers.CommandLogSerializer
|
serializer_class = serializers.CommandLogSerializer
|
||||||
|
permission_classes = (IsSuperUserOrTerminalUser,)
|
||||||
|
|
|
@ -60,14 +60,14 @@ class ProxyLog(models.Model):
|
||||||
|
|
||||||
class CommandLog(models.Model):
|
class CommandLog(models.Model):
|
||||||
proxy_log = models.ForeignKey(ProxyLog, on_delete=models.CASCADE, related_name='command_log')
|
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)
|
command = models.CharField(max_length=1000, blank=True)
|
||||||
output = models.TextField(blank=True)
|
output = models.TextField(blank=True)
|
||||||
date_start = models.DateTimeField(null=True)
|
datetime = models.DateTimeField(null=True)
|
||||||
date_finished = models.DateTimeField(null=True)
|
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return '%s: %s' % (self.id, self.command)
|
return '%s: %s' % (self.id, self.command)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'command_log'
|
db_table = 'command_log'
|
||||||
ordering = ['-date_start', 'command']
|
ordering = ['command_no', 'command']
|
||||||
|
|
|
@ -16,5 +16,4 @@ class CommandLogSerializer(serializers.ModelSerializer):
|
||||||
model = models.CommandLog
|
model = models.CommandLog
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
pass
|
|
||||||
|
|
Loading…
Reference in New Issue