mirror of https://github.com/jumpserver/jumpserver
合并简单
parent
0873211d13
commit
c1d8de4558
|
@ -1,7 +1,11 @@
|
|||
# coding: utf-8
|
||||
|
||||
import socket
|
||||
import sys
|
||||
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf8')
|
||||
|
||||
import socket
|
||||
import os
|
||||
import re
|
||||
import ast
|
||||
|
@ -218,6 +222,7 @@ def print_user_host(username):
|
|||
hosts.sort()
|
||||
for ip in hosts:
|
||||
print '%-15s -- %s' % (ip, hosts_attr[ip][2])
|
||||
print ''
|
||||
|
||||
|
||||
def print_user_hostgroup(username):
|
||||
|
|
|
@ -4,8 +4,6 @@ import ast
|
|||
|
||||
from django.db.models import Q
|
||||
from django.template import RequestContext
|
||||
from django.shortcuts import render_to_response
|
||||
|
||||
from jperm.models import Perm
|
||||
from jumpserver.api import *
|
||||
|
||||
|
@ -20,11 +18,6 @@ def my_render(template, data, request):
|
|||
return render_to_response(template, data, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def httperror(request, emg):
|
||||
message = emg
|
||||
return render_to_response('error.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def get_host_groups(groups):
|
||||
""" 鑾峰彇涓绘満鎵灞炵殑缁勭被 """
|
||||
ret = []
|
||||
|
@ -832,7 +825,7 @@ def dept_host_ajax(request):
|
|||
else:
|
||||
hosts = Asset.objects.all()
|
||||
|
||||
return my_render('jasset/dept_host_ajax.html', locals())
|
||||
return my_render('jasset/dept_host_ajax.html', locals(), request)
|
||||
|
||||
|
||||
@require_login
|
||||
|
|
|
@ -187,18 +187,15 @@ def perm_edit_adm(request):
|
|||
@require_admin
|
||||
def perm_detail(request):
|
||||
header_title, path1, path2 = u'缂栬緫鎺堟潈', u'鎺堟潈绠$悊', u'鎺堟潈璇︽儏'
|
||||
perm_id = request.GET.get('id')
|
||||
perm = Perm.objects.filter(id=perm_id)
|
||||
if perm:
|
||||
perm = perm[0]
|
||||
user_groups = perm.user_group.all()
|
||||
asset_groups = perm.asset_group.all()
|
||||
|
||||
users_list = []
|
||||
group_id = request.GET.get('id')
|
||||
user_group = UserGroup.objects.filter(id=group_id)
|
||||
if user_group:
|
||||
user_group = user_group[0]
|
||||
users_list = user_group.user_set.all()
|
||||
perms = user_group.perm_set.all()
|
||||
asset_groups = [perm.asset_group for perm in perms]
|
||||
assets_list = []
|
||||
|
||||
for user_group in user_groups:
|
||||
users_list.extend(user_group.user_set.all())
|
||||
for asset_group in asset_groups:
|
||||
assets_list.extend(asset_group.asset_set.all())
|
||||
|
||||
|
@ -478,7 +475,7 @@ def sudo_refresh(request):
|
|||
asset_groups_select = sudo_perm.asset_group.all()
|
||||
cmd_groups_select = sudo_perm.cmd_group.all()
|
||||
sudo_ldap_add(user_group, user_runas, asset_groups_select, cmd_groups_select)
|
||||
return HttpResponse('ok')
|
||||
return HttpResponse('鍒锋柊sudo鎺堟潈鎴愬姛')
|
||||
|
||||
|
||||
# @require_admin
|
||||
|
@ -652,7 +649,11 @@ def cmd_detail(request):
|
|||
cmd_ids = request.GET.get('id').split(',')
|
||||
cmds = []
|
||||
if len(cmd_ids) == 1:
|
||||
cmd_group = CmdGroup.objects.filter(id=cmd_ids[0])
|
||||
if cmd_ids[0]:
|
||||
cmd_id = cmd_ids[0]
|
||||
else:
|
||||
cmd_id = 1
|
||||
cmd_group = CmdGroup.objects.filter(id=cmd_id)
|
||||
if cmd_group:
|
||||
cmd_group = cmd_group[0]
|
||||
cmds.extend(cmd_group.cmd.split(','))
|
||||
|
|
|
@ -6,7 +6,6 @@ port = 80
|
|||
key = 88aaaf7ffe3c6c04
|
||||
|
||||
|
||||
|
||||
[db]
|
||||
host = 127.0.0.1
|
||||
port = 3306
|
||||
|
@ -17,14 +16,14 @@ database = jumpserver
|
|||
|
||||
[ldap]
|
||||
ldap_enable = 1
|
||||
host_url = ldap://192.168.0.129:389
|
||||
host_url = ldap://127.0.0.1:389
|
||||
base_dn = dc=jumpserver, dc=org
|
||||
root_dn = cn=admin,dc=jumpserver,dc=org
|
||||
root_pw = secret234
|
||||
|
||||
|
||||
[websocket]
|
||||
web_socket_host = 192.168.0.129:3000
|
||||
web_socket_host = 192.168.20.209:3000
|
||||
|
||||
|
||||
[mail]
|
||||
|
|
|
@ -487,3 +487,7 @@ def is_dir(dir_name, username='root', mode=0755):
|
|||
def success(request, msg):
|
||||
return render_to_response('success.html', locals())
|
||||
|
||||
|
||||
def httperror(request, emg):
|
||||
message = emg
|
||||
return render_to_response('error.html', locals())
|
|
@ -231,16 +231,19 @@ def filter_ajax_api(request):
|
|||
|
||||
def install(request):
|
||||
from juser.models import DEPT, User
|
||||
dept = DEPT(id=1, name="瓒呯閮", comment="SUPER DEPT")
|
||||
if User.objects.filter(id=5000):
|
||||
return httperror(request, 'Jumpserver宸插垵濮嬪寲锛涓嶈兘閲嶅瀹夎锛')
|
||||
|
||||
dept = DEPT(id=1, name="瓒呯閮", comment="瓒呯骇绠$悊閮ㄩ棬")
|
||||
dept.save()
|
||||
dept2 = DEPT(id=2, name="榛樿", comment="DEFAULT DEPT")
|
||||
dept2 = DEPT(id=2, name="榛樿", comment="榛樿閮ㄩ棬")
|
||||
dept2.save()
|
||||
IDC(id=1, name="榛樿", comment="DEFAULT IDC").save()
|
||||
BisGroup(id=1, name="ALL", dept=dept, comment="ALL USER GROUP").save()
|
||||
IDC(id=1, name="榛樿", comment="榛樿IDC").save()
|
||||
BisGroup(id=1, name="ALL", dept=dept, comment="鎵鏈変富鏈虹粍").save()
|
||||
|
||||
User(id=5000, username="admin", password=md5_crypt('admin'),
|
||||
name='admin', email='admin@jumpserver.org', role='SU', is_active=True, dept=dept).save()
|
||||
return success(request, u'瀹夎鎴愬姛')
|
||||
return success(request, u'Jumpserver鍒濆鍖鎴愬姛')
|
||||
|
||||
|
||||
def download(request):
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<h3 id="jumpTo" class="font-bold text-info"></h3>
|
||||
<div class="error-desc">
|
||||
The server encountered something unexpected that didn't allow it to complete the request. We apologize.<br/>
|
||||
You can go back to main page: <br/><a href="/" class="btn btn-primary m-t">Dashboard</a>
|
||||
You can go back to main page: <br/><a href="/" class="btn btn-primary m-t">棣栭〉</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -196,7 +196,8 @@
|
|||
$.get('/jasset/dept_host_ajax/',
|
||||
{'id': dept_id},
|
||||
function(data){
|
||||
$('#hosts').html(data)
|
||||
$('#assets').html(data)
|
||||
$('#assets_total').html(data)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@
|
|||
$.get('/jasset/dept_host_ajax/',
|
||||
{'id': dept_id},
|
||||
function(data){
|
||||
$('#hosts').html(data)
|
||||
$('#assets').html(data)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -153,7 +153,8 @@
|
|||
var regx = /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/g;
|
||||
// tag.append('<p>'+escapeString(obj.content.replace(regx,''))+'</p>');
|
||||
if (option == 'new') {
|
||||
tag.append('<p style="margin: 2px">' + escapeString(obj.content) + '</p>');
|
||||
// tag.append('<p style="margin: 2px">' + escapeString(obj.content) + '</p>');
|
||||
tag.append('<p>'+escapeString(obj.content.replace(regx,' '))+'</p>');
|
||||
} else if (option == 'exist') {
|
||||
tag.append('<pre>' + exsit_message + '</pre>');
|
||||
}
|
||||
|
@ -208,7 +209,7 @@
|
|||
$.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")
|
||||
});
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
<td>{{ asset.ip }}</td>
|
||||
<td>{{ asset.idc.name }}</td>
|
||||
<td>
|
||||
{% for group in asset.bis_group.all|filter_private %}
|
||||
{% for group in asset.bis_group.all %}
|
||||
{{ group }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
<td class="text-center"> <a href="/jasset/host_list/?gid={{ group.id }}">{{ group.id | ugrp_perm_asset_count }} </a> </td>
|
||||
<td class="text-center"> {{ group.comment }} </td>
|
||||
<td class="text-center">
|
||||
<a href="../perm_detail/?id={{ group.id }}" class="btn btn-xs btn-primary">璇︽儏</a>
|
||||
<a href="../perm_edit/?id={{ group.id }}" class="btn btn-xs btn-danger">鎺堟潈缂栬緫</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -67,13 +67,13 @@
|
|||
<td class="text-center"> {{ dept.name }} </td>
|
||||
<td class="text-center"> <a href="/juser/group_list/?did={{ dept.id }}">{{ dept.id | dept_group_num }}</a> </td>
|
||||
<td class="text-center"> <a href="/juser/user_list/?did={{ dept.id }}">{{ dept.id | dept_user_num}} </a> </td>
|
||||
<td class="text-center"> {{ dept.id | dept_asset_num}} </td>
|
||||
<td class="text-center"> <a href="/jasset/host_list/?did={{ dept.id }}">{{ dept.id | dept_asset_num}} </a> </td>
|
||||
<td class="text-center"> {{ dept.comment }} </td>
|
||||
<td class="text-center">
|
||||
{# <a href="../dept_detail/?id={{ dept.id }}" class="btn btn-xs btn-primary">璇︽儏</a>#}
|
||||
{% ifequal session_role_id 2 %}
|
||||
<a href="../dept_edit/?id={{ dept.id }}" class="btn btn-xs btn-info">缂栬緫</a>
|
||||
<a href="../dept_del/?id={{ dept.id }}" class="btn btn-xs btn-danger {% if dept.id < 3 %} disabled {% endif %} } ">鍒犻櫎</a>
|
||||
<a href="../dept_del/?id={{ dept.id }}" class="btn btn-xs btn-danger {% if dept.id < 3 %} disabled {% endif %} ">鍒犻櫎</a>
|
||||
{% else %}
|
||||
<a href="../dept_edit/?id={{ dept.id }}" class="btn btn-xs btn-info disabled">缂栬緫</a>
|
||||
<a href="../dept_del/?id={{ dept.id }}" class="btn btn-xs btn-danger disabled">鍒犻櫎</a>
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
<table class="table">
|
||||
{% for group in user.group.all %}
|
||||
<tr>
|
||||
<td>{{ group.name }}</td>
|
||||
<td><a href="/jperm/perm_edit/?id={{ group.id }}">{{ group.name }}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
@ -152,7 +152,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
|
||||
<div id="last">
|
||||
<div class="feed-activity-list" >
|
||||
{% for log in logs_last %}
|
||||
|
@ -168,19 +167,17 @@
|
|||
</div>
|
||||
{% endfor %}
|
||||
{% if not logs_last %}
|
||||
(鏃)
|
||||
(鏆鏃)
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if logs_num > 10 %}
|
||||
<button id="show" class="btn btn-primary btn-block m-t"><i class="fa fa-arrow-down"></i> Show All</button>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
<div id="all" style="display: none">
|
||||
<div class="feed-activity-list" >
|
||||
{% for log in logs_all %}
|
||||
|
||||
<div class="feed-element">
|
||||
<a href="profile.html" class="pull-left">
|
||||
<img alt="image" class="img-circle" src="/static/img/{{ session_role_id | to_avatar }}.png">
|
||||
|
@ -189,10 +186,8 @@
|
|||
<small class="pull-right">{{ log.start_time|time_delta }}</small>
|
||||
<strong>{{ log.user }}</strong> 鐧诲綍浜 <span class="text-navy">{{ log.host }}. </span><br>
|
||||
<small class="text-muted">{{ log.start_time|date:"Y-m-d H:i:s" }}</small>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<a href="/jperm/dept_perm_list/">閮ㄩ棬鎺堟潈</a>
|
||||
</li>
|
||||
|
||||
<li class="perm_list perm_edit ">
|
||||
<li class="perm_list perm_edit perm_detail ">
|
||||
<a href="/jperm/perm_list/">灏忕粍鎺堟潈</a>
|
||||
</li>
|
||||
|
||||
|
@ -87,7 +87,7 @@
|
|||
<li id="jperm">
|
||||
<a href="#"><i class="fa fa-edit"></i> <span class="nav-label">鎺堟潈绠$悊</span><span class="fa arrow"></span></a>
|
||||
<ul class="nav nav-second-level">
|
||||
<li class="perm_list perm_edit">
|
||||
<li class="perm_list perm_edit perm_detail">
|
||||
<a href="/jperm/perm_list/">灏忕粍鎺堟潈</a>
|
||||
</li>
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<div class="error-desc">
|
||||
The server success response the request. Congratulations.<br/>
|
||||
You can go back to main page: <br/><a href="/" class="btn btn-primary m-t">浠〃鐩</a>
|
||||
You can go back to main page: <br/><a href="/" class="btn btn-primary m-t">棣栭〉</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading鈥
Reference in New Issue