mirror of https://github.com/jumpserver/jumpserver
perm edit修改
parent
b62bc9d161
commit
b4006d3d36
|
@ -6,12 +6,7 @@ urlpatterns = patterns('jperm.views',
|
|||
# url(r'^$', 'jumpserver.views.home', name='home'),
|
||||
# url(r'^blog/', include('blog.urls')),
|
||||
|
||||
(r'^perm_host/$', 'perm_host'),
|
||||
(r'^perm_add/$', 'perm_add'),
|
||||
(r'^perm_edit/$', 'perm_edit'),
|
||||
(r'^perm_user_show/$', 'perm_user_show'),
|
||||
(r'^perm_host/$', 'perm_list'),
|
||||
(r'^perm_user_edit/$', 'perm_user_edit'),
|
||||
(r'^perm_user_detail/$', 'perm_user_detail'),
|
||||
(r'^perm_group_edit/$', 'perm_group_edit'),
|
||||
(r'^perm_group_detail/$', 'perm_group_detail'),
|
||||
(r'^perm_list/$', 'perm_list'),
|
||||
)
|
||||
|
|
221
jperm/views.py
221
jperm/views.py
|
@ -3,15 +3,32 @@
|
|||
from django.shortcuts import render_to_response
|
||||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
from juser.models import User, UserGroup
|
||||
from jasset.models import Asset
|
||||
from jasset.models import Asset, BisGroup
|
||||
from jperm.models import Perm
|
||||
from django.core.paginator import Paginator, EmptyPage, InvalidPage
|
||||
|
||||
|
||||
def perm_host(request):
|
||||
header_title, path1, path2 = u'涓绘満鎺堟潈 | Perm Host Detail.', u'jperm', u'perm_host'
|
||||
users = contact_list = User.objects.all().order_by('id')
|
||||
groups = contact_list2 = UserGroup.objects.all().order_by('id')
|
||||
def perm_group_update(user_group_name='', user_group_id='', asset_groups_name='', asset_groups_id=''):
|
||||
if user_group_name:
|
||||
user_group = UserGroup.objects.get(name=user_group_name)
|
||||
else:
|
||||
user_group = UserGroup.objects.get(id=user_group_id)
|
||||
|
||||
Perm.objects.filter(user_group=user_group).delete()
|
||||
if asset_groups_name:
|
||||
for asset_group_name in asset_groups_name:
|
||||
asset_group = BisGroup.objects.get(name=asset_group_name)
|
||||
Perm(user_group=user_group, asset_group=asset_group).save()
|
||||
else:
|
||||
for asset_group_id in asset_groups_id:
|
||||
asset_group = BisGroup.objects.get(id=asset_group_id)
|
||||
Perm(user_group=user_group, asset_group=asset_group).save()
|
||||
|
||||
|
||||
def perm_list(request):
|
||||
header_title, path1, path2 = u'涓绘満鎺堟潈 | Perm Host Detail.', u'jperm', u'perm_list'
|
||||
groups = contact_list = UserGroup.objects.all().order_by('type')
|
||||
users = contact_list2 = User.objects.all().order_by('id')
|
||||
p = paginator = Paginator(contact_list, 10)
|
||||
p2 = paginator2 = Paginator(contact_list2, 10)
|
||||
try:
|
||||
|
@ -25,99 +42,103 @@ def perm_host(request):
|
|||
except (EmptyPage, InvalidPage):
|
||||
contacts = paginator.page(paginator.num_pages)
|
||||
contacts2 = paginator2.page(paginator2.num_pages)
|
||||
return render_to_response('jperm/perm_host.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_user_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(),)
|
||||
|
||||
|
||||
def perm_list(request):
|
||||
header_title, path1, path2 = u'鏌ョ湅鐢ㄦ埛鎺堟潈 | Perm User Detail.', u'鎺堟潈绠$悊', u'鐢ㄦ埛璇︽儏'
|
||||
username = request.GET.get('username', None)
|
||||
if not username:
|
||||
return HttpResponseRedirect('/')
|
||||
|
||||
user = User.objects.get(username=username)
|
||||
hosts = []
|
||||
for perm in user.perm_set.all():
|
||||
hosts.append(perm.asset)
|
||||
|
||||
return render_to_response('jperm/perm_list.html', locals())
|
||||
|
||||
|
||||
def perm_edit(request):
|
||||
if request.method == 'GET':
|
||||
header_title, path1, path2 = u'缂栬緫鎺堟潈 | Perm Host Edit.', u'jperm', u'perm_edit'
|
||||
user_group_id = request.GET.get('id')
|
||||
user_group = UserGroup.objects.get(id=user_group_id)
|
||||
asset_groups = BisGroup.objects.all()
|
||||
asset_groups_permed = [perm.asset_group for perm in user_group.perm_set.all()]
|
||||
asset_groups_unperm = [asset_group for asset_group in asset_groups if asset_group not in asset_groups_permed]
|
||||
return render_to_response('jperm/perm_edit.html', locals())
|
||||
else:
|
||||
user_group_name = request.POST.get('user_group_name')
|
||||
asset_groups_selected = request.POST.getlist('asset_group_permed')
|
||||
perm_group_update(user_group_name=user_group_name, asset_groups_id=asset_groups_selected)
|
||||
return HttpResponseRedirect('/jperm/perm_list/')
|
||||
|
||||
|
||||
# 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_user_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(),)
|
||||
|
||||
|
||||
|
|
|
@ -50,18 +50,18 @@ def bool2str(value):
|
|||
return u'鍚'
|
||||
|
||||
|
||||
@register.filter(name='perm_count')
|
||||
def perm_count(user_id):
|
||||
user = User.objects.get(id=int(user_id))
|
||||
return user.perm_set.all().count()
|
||||
|
||||
|
||||
@register.filter(name='member_count')
|
||||
def member_count(group_id):
|
||||
group = UserGroup.objects.get(id=group_id)
|
||||
return group.user_set.count()
|
||||
|
||||
|
||||
@register.filter(name='perm_count')
|
||||
def perm_count(group_id):
|
||||
group = UserGroup.objects.get(id=group_id)
|
||||
return group.perm_set.count()
|
||||
|
||||
|
||||
@register.filter(name='group_type_to_str')
|
||||
def group_type_to_str(type_name):
|
||||
group_types = {
|
||||
|
|
|
@ -5,7 +5,7 @@ urlpatterns = patterns('',
|
|||
# Examples:
|
||||
# url(r'^$', 'jumpserver.views.home', name='home'),
|
||||
# url(r'^blog/', include('blog.urls')),
|
||||
|
||||
(r'^$', 'jumpserver.views.base'),
|
||||
(r'^skin_config/$', 'jumpserver.views.skin_config'),
|
||||
(r'^base/$', 'jumpserver.views.base'),
|
||||
(r'^juser/', include('juser.urls')),
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load mytags %}
|
||||
|
||||
{% block content %}
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
function search_host(text){
|
||||
$("#asset_group_unperm").children().each(function(){$(this).remove();});
|
||||
var permArray = [];
|
||||
$("#asset_group_permed").children().each(function(){
|
||||
permArray.push($(this).text());
|
||||
});
|
||||
$("#asset_groups").children().each(function(){
|
||||
if ($(this).text().search(text) != -1 && permArray.indexOf($(this).text()) == -1) {
|
||||
$("#asset_group_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 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="group_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_group.name }}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<form method="post" action="">
|
||||
<input type="text" name="user_group_name" class="form-control" value="{{ user_group.name }}" style="display: none">
|
||||
<div class="row">
|
||||
<div class="col-sm-5"><h4>鏈巿鏉冧富鏈虹粍</h4>
|
||||
<div>
|
||||
<select id="asset_groups" name="asset_groups" class="form-control" size="10" multiple style="display: none">
|
||||
{% for asset_group in asset_groups %}
|
||||
<option value="{{ asset_group.id }}">{{ asset_group.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select id="asset_group_unperm" name="asset_group_unperm" class="form-control m-b" size="12" multiple>
|
||||
{% for asset_group in asset_groups_unperm %}
|
||||
<option value="{{ asset_group.id }}">{{ asset_group.name }}</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('asset_group_unperm', 'asset_group_permed')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move('asset_group_permed', 'asset_group_unperm')"><i class="fa fa-chevron-left"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-5"><h4>鎺堟潈涓绘満</h4>
|
||||
<div>
|
||||
<select id="asset_group_permed" name="asset_group_permed" class="form-control m-b" size="12" multiple>
|
||||
{% for asset_group in asset_groups_permed %}
|
||||
<option value="{{ asset_group.id }}">{{ asset_group.name }}</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(){$('#asset_group_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">#}
|
||||
{# $("#asset_group_permed").children().each(function(){#}
|
||||
{# $("#asset_groups").append($(this).clone());#}
|
||||
{##}
|
||||
{# if ($(this).prop("selected") == false) {#}
|
||||
{# $("#asset_group_unperm").append(this);#}
|
||||
{# }#}
|
||||
{##}
|
||||
{# $("#asset_groups").children().each(function(){$(this).prop("selected", false)});#}
|
||||
{# });#}
|
||||
{# </script>#}
|
||||
|
||||
{% endblock %}
|
|
@ -1,13 +1,14 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% load mytags %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
{% 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>鏉冮檺涓绘満 {{ user.username }} <small> show perm host info.</small></h5>
|
||||
<h5> 鐢ㄦ埛缁勬巿鏉 <small> show host perm info.</small> </h5>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
|
@ -26,34 +27,168 @@
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content" style="display: block;">
|
||||
<form method="post" action="">
|
||||
<table class="table table-hover">
|
||||
|
||||
<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>ID</th>
|
||||
<th>IP</th>
|
||||
<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 host in hosts %}
|
||||
<tr>
|
||||
<td>{{ host.id }}</td>
|
||||
<td>{{ host.ip }}</td>
|
||||
{% for group in contacts.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center"> {{ group.name }} </td>
|
||||
<td class="text-center"> {{ group.type|group_type_to_str }} </td>
|
||||
<td class="text-center"> {{ group.id|member_count }} </td>
|
||||
<td class="text-center"> {{ group.id|perm_count }} </td>
|
||||
<td class="text-center">
|
||||
<a href="../perm_user_detail/?id={{ group.id }}" class="iframe btn btn-xs btn-primary">璇︽儏</a>
|
||||
<a href="../perm_edit/?id={{ group.id }}" class="btn btn-xs btn-info">缂栬緫</a>
|
||||
<a href="../perm_user_edit/?id={{ usgrouper.id }}" class="btn btn-xs btn-danger">鍒犻櫎</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 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>
|
||||
</form>
|
||||
<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 %}
|
|
@ -34,7 +34,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><a href="/jperm/perm_host/">涓绘満鎺堟潈</a></li>
|
||||
<li><a href="/jperm/perm_list/">涓绘満鎺堟潈</a></li>
|
||||
<li><a href="/jperm/perm_sudo/">Sudo鎺堟潈</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
Loading鈥
Reference in New Issue