mirror of https://github.com/jumpserver/jumpserver
hehe
parent
da4d6b85fc
commit
55c5230eb2
|
@ -60,6 +60,7 @@ def get_user_log(ret_list):
|
|||
@require_login
|
||||
def log_list(request, offset):
|
||||
header_title, path1, path2 = u'查看日志', u'查看日志', u'在线用户'
|
||||
keyword = request.GET.get('keyword', '')
|
||||
web_socket_host = CONF.get('websocket', 'web_socket_host')
|
||||
posts = get_user_log(get_user_info(request, offset))
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
|
@ -72,15 +73,14 @@ def log_kill(request):
|
|||
pid = request.GET.get('id', '')
|
||||
log = Log.objects.filter(pid=pid)
|
||||
if log:
|
||||
pid = log.pid
|
||||
log = log.first()
|
||||
dept_name = log.dept_name
|
||||
deptname = get_session_user_info(request)[4]
|
||||
if is_group_admin(request) and dept_name != deptname:
|
||||
return httperror(request, 'Kill失败, 您无权操作!')
|
||||
|
||||
os.kill(int(pid), 9)
|
||||
Log.objects.filter(pid=pid).update(is_finished=1, end_time=datetime.now())
|
||||
return HttpResponseRedirect('jlog/log_offline.html', locals(), context_instance=RequestContext(request))
|
||||
Log.objects.filter(pid=pid).update(is_finished=1, end_time=datetime.datetime.now())
|
||||
return render_to_response('jlog/log_offline.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
@require_login
|
||||
|
@ -109,6 +109,7 @@ def log_history(request):
|
|||
@require_login
|
||||
def log_search(request):
|
||||
offset = request.GET.get('env', '')
|
||||
keyword = request.GET.get('keyword', '')
|
||||
posts = get_user_log(get_user_info(request, offset))
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
return render_to_response('jlog/log_search.html', locals(), context_instance=RequestContext(request))
|
||||
|
|
|
@ -635,13 +635,14 @@ def cmd_detail(request):
|
|||
@require_login
|
||||
def perm_apply(request):
|
||||
header_title, path1, path2 = u'主机权限申请', u'权限管理', u'申请主机'
|
||||
user_id = request.session.get('user_id')
|
||||
username = User.objects.get(id=user_id).username
|
||||
dept_id = get_user_dept(request)
|
||||
deptname = DEPT.objects.get(id=dept_id).name
|
||||
dept = DEPT.objects.get(id=dept_id)
|
||||
posts = Asset.objects.filter(dept=dept)
|
||||
egroup = dept.bisgroup_set.all()
|
||||
user_id, username = get_session_user_info(request)[0:2]
|
||||
dept_id, deptname, dept = get_session_user_info(request)[3:6]
|
||||
perm_host = user_perm_asset_api(username)
|
||||
all_host = Asset.objects.filter(dept=dept)
|
||||
perm_group = user_perm_group_api(username)
|
||||
all_group = dept.bisgroup_set.all()
|
||||
posts = [g for g in all_host if g not in perm_host]
|
||||
egroup = [d for d in all_group if d not in perm_group]
|
||||
dept_da = User.objects.filter(dept_id=dept_id, role='DA')
|
||||
|
||||
if request.method == 'POST':
|
||||
|
|
|
@ -22,7 +22,7 @@ root_pw = secret234
|
|||
|
||||
|
||||
[websocket]
|
||||
web_socket_host = 192.168.8.220:3000
|
||||
web_socket_host = 192.168.173.129:3000
|
||||
|
||||
|
||||
[web]
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
if (option == 'new') {
|
||||
tag.append('<p style="margin: 2px">' + escapeString(obj.content) + '</p>');
|
||||
} else if (option == 'exist') {
|
||||
tag.append('<span style="margin: 0">' + exsit_message + '</span>');
|
||||
tag.append('<pre>' + exsit_message + '</pre>');
|
||||
}
|
||||
tag.animate({ scrollTop: tag[0].scrollHeight}, 1);
|
||||
});
|
||||
|
@ -204,12 +204,12 @@
|
|||
})
|
||||
|
||||
function cut(num){
|
||||
var g_url = "/jlog/log_kill/"+num;
|
||||
console.log(g_url);
|
||||
var g_url = "/jlog/log_kill/?id="+num;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: g_url,
|
||||
success: window.open("/jlog/log_list/online/","_self")
|
||||
success: window.open("/jlog/log_list/online/", "_self")
|
||||
// error: window.open(g_url, "_self")
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
{% for post in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center" id="username"> {{ post.user }} </td>
|
||||
<td class="text-center" id="ip"> {{ post.dept_name }} </td>
|
||||
<td class="text-center" id="ip"> {{ post.host }} </td>
|
||||
<td class="text-center" id="ip"> {{ post.remote_ip }} </td>
|
||||
<td class="text-center" id="dept_name"> {{ post.dept_name }} </td>
|
||||
<td class="text-center" id="host"> {{ post.host }} </td>
|
||||
<td class="text-center" id="remote_ip"> {{ post.remote_ip }} </td>
|
||||
<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 命令统计 </td>
|
||||
<td class="text-center" id="start_time"> {{ post.start_time|date:"Y-m-d H:i:s"}} </td>
|
||||
<td class="text-center" id="end_time"> {{ post.end_time|date:"Y-m-d H:i:s" }} </td>
|
||||
|
|
|
@ -36,17 +36,17 @@
|
|||
{% endif %}
|
||||
<form id="assetForm" method="post" class="form-horizontal">
|
||||
{% csrf_token %}
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 申请人 </label>
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 申请人 <span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-8"><input type="text" name="applyer" value="{{ username }}" class="form-control" readonly="readonly"></div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 所在部门 </label>
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 所在部门 <span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-8"><input type="text" name="dept" value="{{ deptname }}" class="form-control" readonly="readonly"></div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 部门管理员 </label>
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 部门管理员 <span class="red-fonts">*</span></label>
|
||||
<div class="radio">
|
||||
{% for da in dept_da %}
|
||||
<label><input type="radio" value="{{ da.id }}" id="da" name="da"> {{ da }}</label>
|
||||
|
@ -56,7 +56,7 @@
|
|||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<label for="group" class="col-lg-2 control-label">主机组<span class="red-fonts">*</span></label>
|
||||
<label for="group" class="col-lg-2 control-label">主机组</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="group" name="group" class="form-control m-b" multiple size="10">
|
||||
{% for g in egroup %}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
listening on *:3000
|
Loading…
Reference in New Issue