mirror of https://github.com/jumpserver/jumpserver
update
parent
1084be4712
commit
9b43c6c238
|
@ -16,15 +16,15 @@ class Log(models.Model):
|
|||
'''
|
||||
add by liuzheng
|
||||
'''
|
||||
userMM = models.ManyToManyField(User)
|
||||
logPath = models.TextField()
|
||||
filename = models.CharField(max_length=40)
|
||||
logPWD = models.TextField() # log zip file's
|
||||
nick = models.TextField(null=True) # log's nick name
|
||||
log = models.TextField(null=True)
|
||||
history = models.TextField(null=True)
|
||||
timestamp = models.IntegerField(default=int(time.time()))
|
||||
datetimestamp = models.DateTimeField(auto_now_add=True)
|
||||
# userMM = models.ManyToManyField(User)
|
||||
# logPath = models.TextField()
|
||||
# filename = models.CharField(max_length=40)
|
||||
# logPWD = models.TextField() # log zip file's
|
||||
# nick = models.TextField(null=True) # log's nick name
|
||||
# log = models.TextField(null=True)
|
||||
# history = models.TextField(null=True)
|
||||
# timestamp = models.IntegerField(default=int(time.time()))
|
||||
# datetimestamp = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
|
||||
def __unicode__(self):
|
||||
|
|
|
@ -7,7 +7,7 @@ from jperm.perm_api import user_have_perm
|
|||
from django.http import HttpResponseNotFound
|
||||
from jlog.log_api import renderTemplate
|
||||
|
||||
from jlog.models import Log, ExecLog, FileLog
|
||||
from jlog.models import Log, ExecLog, FileLog,TermLog
|
||||
from jumpserver.settings import LOG_DIR
|
||||
import zipfile
|
||||
import json
|
||||
|
@ -136,9 +136,9 @@ def log_record(request):
|
|||
elif request.method == "POST":
|
||||
log_id = request.REQUEST.get('id', None)
|
||||
if log_id:
|
||||
logs = TermLogRecorder(request.user)
|
||||
log = Log.objects.get(id=int(log_id))
|
||||
return HttpResponse(logs.load_full_log(log.filename))
|
||||
TermL = TermLogRecorder(request.user)
|
||||
log = TermLog.objects.get(id=int(log_id))
|
||||
return HttpResponse(TermL.load_full_log(log.filename))
|
||||
else:
|
||||
return HttpResponse("ERROR")
|
||||
else:
|
||||
|
@ -261,16 +261,16 @@ class TermLogRecorder(object):
|
|||
zf.setpassword(password)
|
||||
zf.writestr(filename, json.dumps(self.log))
|
||||
zf.close()
|
||||
record = Log.objects.create(logPath=filepath, logPWD=password, filename=filename,
|
||||
record = TermLog.objects.create(logPath=filepath, logPWD=password, filename=filename,
|
||||
history=json.dumps(self.CMD), timestamp=int(self.recoderStartTime))
|
||||
if self.user:
|
||||
record.userMM.add(self.user)
|
||||
record.user.add(self.user)
|
||||
except:
|
||||
record = Log.objects.create(logPath='locale', logPWD=password, log=json.dumps(self.log),
|
||||
record = TermLog.objects.create(logPath='locale', logPWD=password, log=json.dumps(self.log),
|
||||
filename=filename, history=json.dumps(self.CMD),
|
||||
timestamp=int(self.recoderStartTime))
|
||||
if self.user:
|
||||
record.userMM.add(self.user)
|
||||
record.user.add(self.user)
|
||||
|
||||
def list(self, user=None, uid=None):
|
||||
tmp = []
|
||||
|
@ -281,7 +281,7 @@ class TermLogRecorder(object):
|
|||
else:
|
||||
user = self.user
|
||||
if user:
|
||||
self._lists = Log.objects.filter(user=user.id)
|
||||
self._lists = TermLog.objects.filter(user=user.id)
|
||||
for i in self._lists.all():
|
||||
tmp.append(
|
||||
{'filename': i.filename, 'locale': i.logPath == 'locale', 'nick': i.nick, 'timestamp': i.timestamp,
|
||||
|
@ -299,7 +299,7 @@ class TermLogRecorder(object):
|
|||
if self._lists:
|
||||
self.file = self._lists.get(filename=filename)
|
||||
else:
|
||||
self.file = Log.objects.get(user=user.id, filename=filename)
|
||||
self.file = TermLog.objects.get(user=user.id, filename=filename)
|
||||
if self.file.logPath == 'locale':
|
||||
return self.file.log
|
||||
else:
|
||||
|
@ -323,7 +323,7 @@ class TermLogRecorder(object):
|
|||
if self._lists:
|
||||
self.file = self._lists.get(filename=filename)
|
||||
else:
|
||||
self.file = Log.objects.get(user=user.id, filename=filename)
|
||||
self.file = TermLog.objects.get(user=user.id, filename=filename)
|
||||
return self.file.history
|
||||
return 'ERROR User(None)'
|
||||
|
||||
|
@ -335,7 +335,7 @@ class TermLogRecorder(object):
|
|||
else:
|
||||
pass
|
||||
if user:
|
||||
Log.objects.get(filename=filename).userMM.add(user)
|
||||
TermLog.objects.get(filename=filename).user.add(user)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -347,6 +347,6 @@ class TermLogRecorder(object):
|
|||
else:
|
||||
pass
|
||||
if user:
|
||||
Log.objects.get(filename=filename).userMM.remove(user)
|
||||
TermLog.objects.get(filename=filename).user.remove(user)
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -103,17 +103,17 @@ NgApp.controller('TerminalRecordCtrl', function ($scope, $http) {
|
|||
};
|
||||
|
||||
var term = new Terminal({
|
||||
rows: 80,
|
||||
cols: 24,
|
||||
rows: 24,
|
||||
cols: 80,
|
||||
useStyle: true,
|
||||
screenKeys: true
|
||||
});
|
||||
var timelist = [];
|
||||
for (var i in data) {
|
||||
totalTime = totalTime > i ? totalTime : i;
|
||||
totalTime = Math.max(totalTime, i);
|
||||
timelist.push(i);
|
||||
}
|
||||
timelist = timelist.sort();
|
||||
timelist = timelist.sort(function(a, b){return a-b});
|
||||
totalTime = totalTime * 1000;
|
||||
document.getElementById("afterScrubberText").innerHTML = buildTimeString(totalTime);
|
||||
term.open(document.getElementById('terminal'));
|
||||
|
|
|
@ -8,6 +8,11 @@
|
|||
{% include 'nav_cat_bar.html' %}
|
||||
|
||||
<style>
|
||||
iframe {
|
||||
|
||||
overflow:hidden;
|
||||
|
||||
}
|
||||
.bootstrap-dialog-body {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
@ -133,7 +138,7 @@
|
|||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -157,7 +162,7 @@
|
|||
title: title,
|
||||
maxmin: true,
|
||||
shade: false,
|
||||
area: ['800px', '520px'],
|
||||
area: ['620px', '450px'],
|
||||
content: url
|
||||
});
|
||||
return false;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html ng-app="NgApp">
|
||||
<html ng-app="NgApp" style=" overflow:hidden;">
|
||||
<head lang="en">
|
||||
<title>Jumpserver 录像回放</title>
|
||||
<script type="application/javascript" src='/static/js/jquery-2.1.1.js'></script>
|
||||
|
|
Loading…
Reference in New Issue