mirror of https://github.com/jumpserver/jumpserver
connect.py修改
parent
c1686d52e9
commit
35d9be5c10
17
connect.py
17
connect.py
|
@ -25,6 +25,7 @@ django.setup()
|
|||
from juser.models import User
|
||||
from jasset.models import Asset
|
||||
from jlog.models import Log
|
||||
from jperm.views import perm_user_asset
|
||||
|
||||
try:
|
||||
import termios
|
||||
|
@ -207,15 +208,10 @@ def posix_shell(chan, username, host):
|
|||
def get_user_host(username):
|
||||
"""Get the hosts of under the user control."""
|
||||
hosts_attr = {}
|
||||
try:
|
||||
user = User.objects.get(username=username)
|
||||
except ObjectDoesNotExist:
|
||||
raise ServerError("Username \033[1;31m%s\033[0m doesn't exist on Jumpserver." % username)
|
||||
else:
|
||||
perm_all = user.permission_set.all()
|
||||
for perm in perm_all:
|
||||
hosts_attr[perm.asset.ip] = [perm.asset.id, perm.asset.comment]
|
||||
return hosts_attr
|
||||
asset_all = perm_user_asset(username=username)
|
||||
for asset in asset_all:
|
||||
hosts_attr[asset.ip] = [asset.id, asset.comment]
|
||||
return hosts_attr
|
||||
|
||||
|
||||
def get_connect_item(username, ip):
|
||||
|
@ -234,7 +230,6 @@ def get_connect_item(username, ip):
|
|||
|
||||
login_type_dict = {
|
||||
'L': user.ldap_pwd,
|
||||
'S': user.ssh_key_pwd2,
|
||||
'P': user.ssh_pwd,
|
||||
}
|
||||
|
||||
|
@ -244,7 +239,7 @@ def get_connect_item(username, ip):
|
|||
|
||||
elif asset.login_type == 'M':
|
||||
username = asset.username
|
||||
password= cryptor.decrypt(asset.password)
|
||||
password = cryptor.decrypt(asset.password)
|
||||
return username, password, ip, port
|
||||
|
||||
else:
|
||||
|
|
|
@ -25,8 +25,11 @@ def perm_group_update(user_group_name='', user_group_id='', asset_groups_name=''
|
|||
Perm(user_group=user_group, asset_group=asset_group).save()
|
||||
|
||||
|
||||
def perm_user_asset(user_id):
|
||||
user = User.objects.get(id=user_id)
|
||||
def perm_user_asset(user_id=None, username=None):
|
||||
if user_id:
|
||||
user = User.objects.get(id=user_id)
|
||||
else:
|
||||
user = User.objects.get(username=username)
|
||||
user_groups = user.user_group.all()
|
||||
perms = []
|
||||
assets = []
|
||||
|
@ -99,84 +102,3 @@ def perm_asset_detail(request):
|
|||
return render_to_response('jperm/perm_asset_detail.html', locals())
|
||||
|
||||
|
||||
# def perm_user_host(username, ips):
|
||||
# user = User.objects.get(username=username)
|
||||
# user.perm_set.all().delete()
|
||||
# for ip in ips:
|
||||
# asset = Asset.objects.get(ip=ip)
|
||||
# Perm.objects.create(user=user, asset=asset)
|
||||
#
|
||||
#
|
||||
# def perm_user_edit(request):
|
||||
# header_title, path1, path2 = u'鎺堟潈缂栬緫 | Perm Edit.', u'jperm', u'perm_edit'
|
||||
# if request.method == 'GET':
|
||||
# if request.GET.get('id', None):
|
||||
# user_id = request.GET.get('id')
|
||||
# user = User.objects.get(id=user_id)
|
||||
# assets = Asset.objects.all()
|
||||
# assets_permed = []
|
||||
# for perm in user.perm_set.all():
|
||||
# assets_permed.append(perm.asset)
|
||||
# assets_unperm = list(set(assets)-set(assets_permed))
|
||||
# return render_to_response('jperm/perm_user_edit.html', locals())
|
||||
# else:
|
||||
# host_ips = request.POST.getlist('host_permed', '')
|
||||
# username = request.POST.get('username')
|
||||
# perm_user_host(username, host_ips)
|
||||
#
|
||||
# return HttpResponseRedirect('/jperm/perm_host/')
|
||||
#
|
||||
#
|
||||
# def perm_user_detail(request):
|
||||
# user_id = request.GET.get('id', '')
|
||||
# user = User.objects.get(id=user_id)
|
||||
# host_permed = []
|
||||
# for perm in user.perm_set.all():
|
||||
# host_permed.append(perm.asset)
|
||||
#
|
||||
# return render_to_response('jperm/perm_detail.html', locals())
|
||||
#
|
||||
#
|
||||
# def perm_group_edit(request):
|
||||
# if request.method == 'GET':
|
||||
# group_id = request.GET.get('id', '')
|
||||
# group = UserGroup.objects.get(id=group_id)
|
||||
#
|
||||
# return render_to_response('jperm/perm_group_edit.html')
|
||||
#
|
||||
#
|
||||
# def perm_add(request):
|
||||
# header_title, path1, path2 = u'娣诲姞鎺堟潈 | Add User perm.', u'鎺堟潈绠$悊', u'娣诲姞鎺堟潈'
|
||||
# if request.method == 'GET':
|
||||
# username = request.GET.get('username', None)
|
||||
# if not username:
|
||||
# return HttpResponseRedirect('/')
|
||||
#
|
||||
# user = User.objects.get(username=username)
|
||||
# permed_hosts = []
|
||||
# for perm in user.perm_set.all():
|
||||
# permed_hosts.append(perm.asset)
|
||||
#
|
||||
# hosts_all = Asset.objects.all()
|
||||
# hosts = list(set(hosts_all) - set(permed_hosts))
|
||||
#
|
||||
# else:
|
||||
# username = request.POST.get('username', None)
|
||||
# host_ids = request.POST.getlist('host_ids', None)
|
||||
#
|
||||
# user = User.objects.get(username=username)
|
||||
# for host_id in host_ids:
|
||||
# asset = Asset.objects.get(id=host_id)
|
||||
# perm = Perm(user=user, asset=asset)
|
||||
# perm.save()
|
||||
# msg = u'娣诲姞鎴愬姛'
|
||||
#
|
||||
# return render_to_response('jperm/perm_add.html', locals())
|
||||
#
|
||||
#
|
||||
# def perm_user_show(request):
|
||||
# header_title, path1, path2 = u'鏌ョ湅鎺堟潈鐢ㄦ埛 | Perm User Detail.', u'鎺堟潈绠$悊', u'鐢ㄦ埛璇︽儏'
|
||||
# users = User.objects.all()
|
||||
# return render_to_response('jperm/perm_user_show.html', locals(),)
|
||||
|
||||
|
||||
|
|
|
@ -1,151 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load mytags %}
|
||||
|
||||
{% block content %}
|
||||
<script type="text/javascript">
|
||||
|
||||
function move(from, to) {
|
||||
$("#"+from+" option").each(function(){
|
||||
if ( $(this).prop("selected") == true ) {
|
||||
$("#"+to).append(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function move_all(from, to){
|
||||
$("#"+from).children().each(function(){
|
||||
$("#"+to).append(this);
|
||||
});
|
||||
}
|
||||
|
||||
function search_host(text){
|
||||
$("#host_unperm").children().each(function(){$(this).remove();});
|
||||
var permArray = [];
|
||||
$("#host_permed").children().each(function(){
|
||||
permArray.push($(this).text());
|
||||
});
|
||||
$("#host_all").children().each(function(){
|
||||
if ($(this).text().search(text) != -1 && permArray.indexOf($(this).text()) == -1) {
|
||||
$("#host_unperm").append($(this).clone())
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<div class="ibox float-e-margins">
|
||||
<!-- title -->
|
||||
<div class="ibox-title">
|
||||
<h5>鎺堟潈缂栬緫琛ㄥ崟 <small>Edit perm of user group</small></h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">Config option 1</a>
|
||||
</li>
|
||||
<li><a href="#">Config option 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end title -->
|
||||
<div class="ibox-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-5 ">
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
<input type="text" id="host_filter" placeholder="Search" class="form-control" value="" oninput="search_host(this.value)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-1 ">
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-5 ">
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
<input type="text" class="form-control" value="{{ group.name }}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<form method="post" action="">
|
||||
<input type="text" name="username" class="form-control" value="{{ group.name }}" style="display: none">
|
||||
<div class="row">
|
||||
<div class="col-sm-5"><h4>鏈巿鏉冧富鏈</h4>
|
||||
<div>
|
||||
<select id="host_all" name="host_all" class="form-control" size="10" multiple style="display: none">
|
||||
{% for asset in assets %}
|
||||
<option value="{{ asset.ip }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select id="host_unperm" name="host_unperm" class="form-control m-b" size="12" multiple>
|
||||
{% for asset in assets_unperm %}
|
||||
<option value="{{ asset.ip }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 50px;">
|
||||
<button type="button" class="btn btn-white" onclick="move('host_unperm', 'host_permed')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move('host_permed', 'host_unperm')"><i class="fa fa-chevron-left"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-5"><h4>鎺堟潈涓绘満</h4>
|
||||
<div>
|
||||
<select id="host_permed" name="host_permed" class="form-control m-b" size="12" multiple>
|
||||
{% for asset in assets_permed %}
|
||||
<option value="{{ asset.ip }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-2">
|
||||
<button class="btn btn-white" type="submit">鍙栨秷</button>
|
||||
<button class="btn btn-primary" type="submit" onclick="javascript: (function(){$('#host_permed option').each(function(){$(this).prop('selected', true)})})()">纭淇濆瓨</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var str = document.location.pathname.split("/")[1];
|
||||
var str1 = document.location.pathname.split("/")[2];
|
||||
$("#"+str).addClass('active');
|
||||
$("#"+str1).addClass('active');
|
||||
</script>
|
||||
{# <script type="text/javascript">#}
|
||||
{# $("#host_permed").children().each(function(){#}
|
||||
{# $("#host_all").append($(this).clone());#}
|
||||
{##}
|
||||
{# if ($(this).prop("selected") == false) {#}
|
||||
{# $("#host_unperm").append(this);#}
|
||||
{# }#}
|
||||
{##}
|
||||
{# $("#host_all").children().each(function(){$(this).prop("selected", false)});#}
|
||||
{# });#}
|
||||
{# </script>#}
|
||||
|
||||
{% endblock %}
|
|
@ -1,193 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load mytags %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5> 涓绘満鎺堟潈 <small> show host perm info.</small> </h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">鏈惎鐢 1</a>
|
||||
</li>
|
||||
<li><a href="#">鏈惎鐢 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ibox-content">
|
||||
<div class="panel blank-panel">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-options">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#tab-1">鐢ㄦ埛鎺堟潈</a></li>
|
||||
<li class=""><a data-toggle="tab" href="#tab-2">鐢ㄦ埛缁勬巿鏉</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="tab-1" class="tab-pane active">
|
||||
<table class="table table-striped table-bordered table-hover " id="editable" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">鐢ㄦ埛鍚</th>
|
||||
<th class="text-center">濮撳悕</th>
|
||||
<th class="text-center">灞炵粍</th>
|
||||
<th class="text-center">鎺堟潈鎬绘暟</th>
|
||||
<th class="text-center">鎿嶄綔</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center"> {{ user.username }} </td>
|
||||
<td class="text-center"> {{ user.name }} </td>
|
||||
<td class="text-center"> {{ user.username|groups_str }} </td>
|
||||
<td class="text-center"> {{ user.id|perm_count }} </td>
|
||||
<td class="text-center">
|
||||
<a href="../perm_user_detail/?id={{ user.id }}" class="iframe btn btn-xs btn-primary">璇︽儏</a>
|
||||
<a href="../perm_user_edit/?id={{ user.id }}" class="btn btn-xs btn-info">缂栬緫</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
|
||||
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
|
||||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
{% if contacts.has_previous %}
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?page={{ contacts.previous_page_number }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% for page in p.page_range %}
|
||||
{% ifequal offset1 page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="绗瑊{ page }}椤">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="绗瑊{ page }}椤">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% if contacts.has_next %}
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?page={{ contacts.next_page_number }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tab-2" class="tab-pane">
|
||||
<table class="table table-striped table-bordered table-hover " id="editable" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">缁勫悕</th>
|
||||
<th class="text-center">澶囨敞</th>
|
||||
<th class="text-center">鎿嶄綔</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for group in contacts2.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center"> {{ group.name }} </td>
|
||||
<td class="text-center"> {{ group.comment }} </td>
|
||||
<td class="text-center">
|
||||
<a href="../perm_group_detail/?id={{ user.id }}" class="iframe btn btn-xs btn-primary">璇︽儏</a>
|
||||
<a href="../perm_group_edit/?id={{ user.id }}" class="btn btn-xs btn-info">缂栬緫</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
|
||||
Showing {{ contacts2.start_index }} to {{ contacts2.end_index }} of {{ p2.count }} entries
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
|
||||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
{% if contacts2.has_previous %}
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?page={{ contacts2.previous_page_number }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% for page in p2.page_range %}
|
||||
{% ifequal offset1 page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="绗瑊{ page }}椤">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="绗瑊{ page }}椤">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% if contacts2.has_next %}
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?page={{ contacts2.next_page_number }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".iframe").colorbox({iframe:true, width:"70%", height:"70%"});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -1,138 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load mytags %}
|
||||
|
||||
{% block content %}
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
function search_host(text){
|
||||
$("#host_unperm").children().each(function(){$(this).remove();});
|
||||
var permArray = [];
|
||||
$("#host_permed").children().each(function(){
|
||||
permArray.push($(this).text());
|
||||
});
|
||||
$("#host_all").children().each(function(){
|
||||
if ($(this).text().search(text) != -1 && permArray.indexOf($(this).text()) == -1) {
|
||||
$("#host_unperm").append($(this).clone())
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<div class="ibox float-e-margins">
|
||||
<!-- title -->
|
||||
<div class="ibox-title">
|
||||
<h5>鎺堟潈缂栬緫琛ㄥ崟 <small>Edit perm of user</small></h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">Config option 1</a>
|
||||
</li>
|
||||
<li><a href="#">Config option 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end title -->
|
||||
<div class="ibox-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-5 ">
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
<input type="text" id="host_filter" placeholder="Search" class="form-control" value="" oninput="search_host(this.value)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-1 ">
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-5 ">
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
<input type="text" class="form-control" value="{{ user.name }}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<form method="post" action="">
|
||||
<input type="text" name="username" class="form-control" value="{{ user.username }}" style="display: none">
|
||||
<div class="row">
|
||||
<div class="col-sm-5"><h4>鏈巿鏉冧富鏈</h4>
|
||||
<div>
|
||||
<select id="host_all" name="host_all" class="form-control" size="10" multiple style="display: none">
|
||||
{% for asset in assets %}
|
||||
<option value="{{ asset.ip }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select id="host_unperm" name="host_unperm" class="form-control m-b" size="12" multiple>
|
||||
{% for asset in assets_unperm %}
|
||||
<option value="{{ asset.ip }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 50px;">
|
||||
<button type="button" class="btn btn-white" onclick="move('host_unperm', 'host_permed')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move('host_permed', 'host_unperm')"><i class="fa fa-chevron-left"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-5"><h4>鎺堟潈涓绘満</h4>
|
||||
<div>
|
||||
<select id="host_permed" name="host_permed" class="form-control m-b" size="12" multiple>
|
||||
{% for asset in assets_permed %}
|
||||
<option value="{{ asset.ip }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-2">
|
||||
<button class="btn btn-white" type="submit">鍙栨秷</button>
|
||||
<button class="btn btn-primary" type="submit" onclick="javascript: (function(){$('#host_permed option').each(function(){$(this).prop('selected', true)})})()">纭淇濆瓨</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var str = document.location.pathname.split("/")[1];
|
||||
var str1 = document.location.pathname.split("/")[2];
|
||||
$("#"+str).addClass('active');
|
||||
$("#"+str1).addClass('active');
|
||||
</script>
|
||||
{# <script type="text/javascript">#}
|
||||
{# $("#host_permed").children().each(function(){#}
|
||||
{# $("#host_all").append($(this).clone());#}
|
||||
{##}
|
||||
{# if ($(this).prop("selected") == false) {#}
|
||||
{# $("#host_unperm").append(this);#}
|
||||
{# }#}
|
||||
{##}
|
||||
{# $("#host_all").children().each(function(){$(this).prop("selected", false)});#}
|
||||
{# });#}
|
||||
{# </script>#}
|
||||
|
||||
{% endblock %}
|
|
@ -1,61 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load mytags %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>鐢ㄦ埛淇℃伅 <small> show user info.</small></h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">鏈惎鐢 1</a>
|
||||
</li>
|
||||
<li><a href="#">鏈惎鐢 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content" style="display: block;">
|
||||
<form method="post" action="">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>娣诲姞鎺堟潈</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr>
|
||||
<td>{{ user.id }}</td>
|
||||
<td>{{ user.username }}</td>
|
||||
<td><a href="../perm_list/?username={{ user.username }}">鏌ョ湅鏉冮檺</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-2">
|
||||
<button class="btn btn-white" type="submit">鍙栨秷</button>
|
||||
<button id="submit_button" class="btn btn-primary" type="submit">纭鍒犻櫎</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading鈥
Reference in New Issue