mirror of https://github.com/jumpserver/jumpserver
资产修改基本完成
parent
960e45d0fa
commit
907c2c7e97
|
@ -37,8 +37,15 @@ def db_asset_add(**kwargs):
|
|||
add asset to db
|
||||
添加主机时数据库操作函数
|
||||
"""
|
||||
group_id_list = kwargs.pop('groups')
|
||||
asset = Asset(**kwargs)
|
||||
asset.save()
|
||||
|
||||
Asset(**kwargs).save()
|
||||
group_select = []
|
||||
for group_id in group_id_list:
|
||||
group = AssetGroup.objects.filter(id=group_id)
|
||||
group_select.extend(group)
|
||||
asset.group = group_select
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -7,6 +7,7 @@ urlpatterns = patterns('',
|
|||
# url(r"^host_add_multi/$", host_add_batch),
|
||||
url(r'^group_add/$', group_add),
|
||||
url(r'^group_list/$', group_list),
|
||||
url(r'^group_del/$', group_del),
|
||||
url(r'^asset_list/$', asset_list),
|
||||
url(r'^asset_del/$', asset_del),
|
||||
url(r"^asset_detail/$", asset_detail),
|
||||
|
@ -19,7 +20,7 @@ urlpatterns = patterns('',
|
|||
# url(r'^group_list/$', group_list),
|
||||
# url(r'^group_detail/$', group_detail),
|
||||
# url(r'^group_del_host/$', group_del_host),
|
||||
# url(r'^group_del/$', group_del),
|
||||
|
||||
# url(r'^host_edit/batch/$', host_edit_batch),
|
||||
# url(r'^host_edit_common/batch/$', host_edit_common_batch),
|
||||
)
|
|
@ -57,12 +57,27 @@ def group_list(request):
|
|||
asset_group_list = AssetGroup.objects.all()
|
||||
|
||||
if keyword:
|
||||
asset_groups = asset_group_list.filter(Q(name__contains=keyword) | Q(comment__contains=keyword))
|
||||
asset_group_list = asset_group_list.filter(Q(name__contains=keyword) | Q(comment__contains=keyword))
|
||||
|
||||
asset_group_list, p, asset_groups, page_range, current_page, show_first, show_end = pages(asset_group_list, request)
|
||||
return my_render('jasset/group_list.html', locals(), request)
|
||||
|
||||
|
||||
@require_role('admin')
|
||||
def group_del(request):
|
||||
"""
|
||||
del asset group
|
||||
删除主机组
|
||||
"""
|
||||
group_ids = request.GET.get('id', '')
|
||||
group_id_list = group_ids.split(',')
|
||||
|
||||
for group_id in group_id_list:
|
||||
AssetGroup.objects.filter(id=group_id).delete()
|
||||
|
||||
return HttpResponse(u'删除成功')
|
||||
|
||||
|
||||
@require_role('admin')
|
||||
def asset_add(request):
|
||||
"""
|
||||
|
@ -70,10 +85,11 @@ def asset_add(request):
|
|||
添加资产
|
||||
"""
|
||||
header_title, path1, path2 = u'添加资产', u'资产管理', u'添加资产'
|
||||
asset_group_all = AssetGroup.objects.all()
|
||||
if request.method == 'POST':
|
||||
ip = request.POST.get('ip')
|
||||
port = request.POST.get('port')
|
||||
group = request.POST.getlist('group')
|
||||
groups = request.POST.getlist('groups')
|
||||
use_default_auth = True if request.POST.getlist('use_default_auth', []) else False
|
||||
is_active = True if request.POST.get('is_active') else False
|
||||
comment = request.POST.get('comment')
|
||||
|
@ -96,7 +112,7 @@ def asset_add(request):
|
|||
else:
|
||||
db_asset_add(
|
||||
ip=ip, port=port, use_default_auth=use_default_auth, is_active=is_active, comment=comment,
|
||||
username=username, password=password_encode
|
||||
groups=groups, username=username, password=password_encode
|
||||
)
|
||||
|
||||
msg = u'主机 %s 添加成功' % ip
|
||||
|
@ -447,27 +463,7 @@ def asset_detail(request):
|
|||
#
|
||||
# return HttpResponseRedirect('/jasset/group_detail/?id=%s' % group.id)
|
||||
#
|
||||
#
|
||||
# @require_admin
|
||||
# def group_del(request):
|
||||
# """ 删除主机组 """
|
||||
# offset = request.GET.get('id', '')
|
||||
# if offset == 'multi':
|
||||
# len_list = request.POST.get("len_list")
|
||||
# for i in range(int(len_list)):
|
||||
# key = "id_list[" + str(i) + "]"
|
||||
# gid = request.POST.get(key)
|
||||
# if is_group_admin(request) and not validate(request, asset_group=[gid]):
|
||||
# return httperror(request, '删除失败, 您无权删除!')
|
||||
# BisGroup.objects.filter(id=gid).delete()
|
||||
# else:
|
||||
# gid = int(offset)
|
||||
# if is_group_admin(request) and not validate(request, asset_group=[gid]):
|
||||
# return httperror(request, '删除失败, 您无权删除!')
|
||||
# BisGroup.objects.filter(id=gid).delete()
|
||||
# return HttpResponseRedirect('/jasset/group_list/')
|
||||
#
|
||||
#
|
||||
|
||||
# @require_admin
|
||||
# def dept_host_ajax(request):
|
||||
# """ 添加主机组时, 部门联动主机异步 """
|
||||
|
|
|
@ -1,52 +1,60 @@
|
|||
import datetime
|
||||
|
||||
from uuidfield import UUIDField
|
||||
|
||||
from django.db import models
|
||||
from juser.models import UserGroup
|
||||
from juser.models import User, UserGroup
|
||||
from jasset.models import Asset, AssetGroup
|
||||
|
||||
|
||||
class Perm(models.Model):
|
||||
class UserPerm(models.Model):
|
||||
user = models.ForeignKey(User)
|
||||
asset = models.ForeignKey(Asset, null=True)
|
||||
asset_group = models.ForeignKey(AssetGroup, null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.user.name
|
||||
|
||||
|
||||
class GroupPerm(models.Model):
|
||||
user_group = models.ForeignKey(UserGroup)
|
||||
asset_group = models.ForeignKey(AssetGroup)
|
||||
asset = models.ForeignKey(Asset, null=True)
|
||||
asset_group = models.ForeignKey(AssetGroup, null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return '%s_%s' % (self.user_group.name, self.asset_group.name)
|
||||
return self.user.name
|
||||
|
||||
|
||||
class CmdGroup(models.Model):
|
||||
name = models.CharField(max_length=50, unique=True)
|
||||
cmd = models.CharField(max_length=999)
|
||||
comment = models.CharField(blank=True, null=True, max_length=50)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class SudoPerm(models.Model):
|
||||
user_group = models.ForeignKey(UserGroup)
|
||||
user_runas = models.CharField(max_length=100)
|
||||
asset_group = models.ManyToManyField(AssetGroup)
|
||||
cmd_group = models.ManyToManyField(CmdGroup)
|
||||
comment = models.CharField(max_length=30, null=True, blank=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.user_group.name
|
||||
|
||||
|
||||
class Apply(models.Model):
|
||||
uuid = UUIDField(auto=True)
|
||||
applyer = models.CharField(max_length=20)
|
||||
admin = models.CharField(max_length=20)
|
||||
approver = models.CharField(max_length=20)
|
||||
bisgroup = models.CharField(max_length=500)
|
||||
asset = models.CharField(max_length=500)
|
||||
comment = models.TextField(blank=True, null=True)
|
||||
status = models.IntegerField(max_length=2)
|
||||
date_add = models.DateTimeField(null=True)
|
||||
date_end = models.DateTimeField(null=True)
|
||||
read = models.IntegerField(max_length=2)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.applyer
|
||||
# class CmdGroup(models.Model):
|
||||
# name = models.CharField(max_length=50, unique=True)
|
||||
# cmd = models.CharField(max_length=999)
|
||||
# comment = models.CharField(blank=True, null=True, max_length=50)
|
||||
#
|
||||
# def __unicode__(self):
|
||||
# return self.name
|
||||
#
|
||||
#
|
||||
# class SudoPerm(models.Model):
|
||||
# user_group = models.ForeignKey(UserGroup)
|
||||
# user_runas = models.CharField(max_length=100)
|
||||
# asset_group = models.ManyToManyField(AssetGroup)
|
||||
# cmd_group = models.ManyToManyField(CmdGroup)
|
||||
# comment = models.CharField(max_length=30, null=True, blank=True)
|
||||
#
|
||||
# def __unicode__(self):
|
||||
# return self.user_group.name
|
||||
#
|
||||
#
|
||||
# class Apply(models.Model):
|
||||
# uuid = UUIDField(auto=True)
|
||||
# applyer = models.CharField(max_length=20)
|
||||
# admin = models.CharField(max_length=20)
|
||||
# approver = models.CharField(max_length=20)
|
||||
# bisgroup = models.CharField(max_length=500)
|
||||
# asset = models.CharField(max_length=500)
|
||||
# comment = models.TextField(blank=True, null=True)
|
||||
# status = models.IntegerField(max_length=2)
|
||||
# date_add = models.DateTimeField(null=True)
|
||||
# date_end = models.DateTimeField(null=True)
|
||||
# read = models.IntegerField(max_length=2)
|
||||
#
|
||||
# def __unicode__(self):
|
||||
# return self.applyer
|
||||
|
|
|
@ -3,31 +3,29 @@ from jperm.views import *
|
|||
|
||||
urlpatterns = patterns('jperm.views',
|
||||
# Examples:
|
||||
# url(r'^$', 'jumpserver.views.home', name='home'),
|
||||
# url(r'^blog/', include('blog.urls')),
|
||||
(r'^user/$', user_perm),
|
||||
# (r'^dept_perm_edit/$', 'dept_perm_edit'),
|
||||
# (r'^perm_list/$', view_splitter, {'su': perm_list, 'adm': perm_list_adm}),
|
||||
# (r'^dept_perm_list/$', 'dept_perm_list'),
|
||||
# (r'^perm_user_detail/$', 'perm_user_detail'),
|
||||
# (r'^perm_detail/$', 'perm_detail'),
|
||||
# (r'^perm_del/$', 'perm_del'),
|
||||
# (r'^perm_asset_detail/$', 'perm_asset_detail'),
|
||||
# (r'^sudo_list/$', view_splitter, {'su': sudo_list, 'adm': sudo_list_adm}),
|
||||
# (r'^sudo_del/$', 'sudo_del'),
|
||||
# (r'^sudo_edit/$', view_splitter, {'su': sudo_edit, 'adm': sudo_edit_adm}),
|
||||
# (r'^sudo_refresh/$', 'sudo_refresh'),
|
||||
# (r'^sudo_detail/$', 'sudo_detail'),
|
||||
# (r'^cmd_add/$', view_splitter, {'su': cmd_add, 'adm': cmd_add_adm}),
|
||||
# (r'^cmd_list/$', 'cmd_list'),
|
||||
# (r'^cmd_del/$', 'cmd_del'),
|
||||
# (r'^cmd_edit/$', 'cmd_edit'),
|
||||
# (r'^cmd_detail/$', 'cmd_detail'),
|
||||
# (r'^apply/$', 'perm_apply'),
|
||||
# (r'^apply_show/(\w+)/$', 'perm_apply_log'),
|
||||
# (r'^apply_exec/$', 'perm_apply_exec'),
|
||||
# (r'^apply_info/$', 'perm_apply_info'),
|
||||
# (r'^apply_del/$', 'perm_apply_del'),
|
||||
# (r'^apply_search/$', 'perm_apply_search'),
|
||||
|
||||
(r'^perm_edit/$', view_splitter, {'su': perm_edit, 'adm': perm_edit_adm}),
|
||||
(r'^dept_perm_edit/$', 'dept_perm_edit'),
|
||||
(r'^perm_list/$', view_splitter, {'su': perm_list, 'adm': perm_list_adm}),
|
||||
(r'^dept_perm_list/$', 'dept_perm_list'),
|
||||
(r'^perm_user_detail/$', 'perm_user_detail'),
|
||||
(r'^perm_detail/$', 'perm_detail'),
|
||||
(r'^perm_del/$', 'perm_del'),
|
||||
(r'^perm_asset_detail/$', 'perm_asset_detail'),
|
||||
(r'^sudo_list/$', view_splitter, {'su': sudo_list, 'adm': sudo_list_adm}),
|
||||
(r'^sudo_del/$', 'sudo_del'),
|
||||
(r'^sudo_edit/$', view_splitter, {'su': sudo_edit, 'adm': sudo_edit_adm}),
|
||||
(r'^sudo_refresh/$', 'sudo_refresh'),
|
||||
(r'^sudo_detail/$', 'sudo_detail'),
|
||||
(r'^cmd_add/$', view_splitter, {'su': cmd_add, 'adm': cmd_add_adm}),
|
||||
(r'^cmd_list/$', 'cmd_list'),
|
||||
(r'^cmd_del/$', 'cmd_del'),
|
||||
(r'^cmd_edit/$', 'cmd_edit'),
|
||||
(r'^cmd_detail/$', 'cmd_detail'),
|
||||
(r'^apply/$', 'perm_apply'),
|
||||
(r'^apply_show/(\w+)/$', 'perm_apply_log'),
|
||||
(r'^apply_exec/$', 'perm_apply_exec'),
|
||||
(r'^apply_info/$', 'perm_apply_info'),
|
||||
(r'^apply_del/$', 'perm_apply_del'),
|
||||
(r'^apply_search/$', 'perm_apply_search'),
|
||||
)
|
||||
|
|
1592
jperm/views.py
1592
jperm/views.py
File diff suppressed because it is too large
Load Diff
|
@ -16,7 +16,7 @@ urlpatterns = patterns('',
|
|||
(r'^juser/', include('juser.urls')),
|
||||
(r'^jasset/', include('jasset.urls')),
|
||||
# (r'^jlog/', include('jlog.urls')),
|
||||
# (r'^jperm/', include('jperm.urls')),
|
||||
(r'^jperm/', include('jperm.urls')),
|
||||
(r'^node_auth/', 'jumpserver.views.node_auth'),
|
||||
|
||||
)
|
||||
|
|
|
@ -10,7 +10,6 @@ urlpatterns = patterns('juser.views',
|
|||
(r'^group_add/$', group_add),
|
||||
(r'^group_list/$', group_list),
|
||||
(r'^group_del/$', group_del),
|
||||
(r'^group_del_ajax', group_del_ajax),
|
||||
(r'^group_edit/$', group_edit),
|
||||
(r'^user_add/$', user_add),
|
||||
(r'^user_list/$', user_list),
|
||||
|
@ -19,8 +18,7 @@ urlpatterns = patterns('juser.views',
|
|||
(r'^forget_password/$', forget_password),
|
||||
(r'^user_detail/$', 'user_detail'),
|
||||
(r'^user_del/$', 'user_del'),
|
||||
(r'^user_del_ajax/$', 'user_del_ajax'),
|
||||
(r'^user_edit/$', view_splitter, {'su': user_edit, 'adm': user_edit_adm}),
|
||||
(r'^user_edit/$', user_edit),
|
||||
(r'^profile/$', 'profile'),
|
||||
(r'^change_info/$', 'change_info'),
|
||||
(r'^regen_ssh_key/$', 'regen_ssh_key'),
|
||||
|
|
|
@ -81,21 +81,14 @@ def group_del(request):
|
|||
del a group
|
||||
删除用户组
|
||||
"""
|
||||
group_id = request.GET.get('id', '')
|
||||
if not group_id:
|
||||
return HttpResponseRedirect('/')
|
||||
UserGroup.objects.filter(id=group_id).delete()
|
||||
return HttpResponseRedirect('/juser/group_list/')
|
||||
|
||||
|
||||
@require_role(role='super')
|
||||
def group_del_ajax(request):
|
||||
group_ids = request.POST.get('group_ids')
|
||||
group_ids = group_ids.split(',')
|
||||
for group_id in group_ids:
|
||||
group_ids = request.GET.get('id', '')
|
||||
group_id_list = group_ids.split(',')
|
||||
for group_id in group_id_list:
|
||||
UserGroup.objects.filter(id=group_id).delete()
|
||||
|
||||
return HttpResponse('删除成功')
|
||||
|
||||
|
||||
# @require_role(role='admin')
|
||||
# def group_list_adm(request):
|
||||
# header_title, path1, path2 = '查看部门小组', '用户管理', '查看小组'
|
||||
|
@ -424,30 +417,10 @@ def user_detail(request):
|
|||
|
||||
@require_role(role='admin')
|
||||
def user_del(request):
|
||||
user_id = request.GET.get('id', '')
|
||||
if not user_id:
|
||||
return HttpResponseRedirect('/juser/user_list/')
|
||||
|
||||
user = get_object(User, id=user_id)
|
||||
if user and user.username != 'admin':
|
||||
user.delete()
|
||||
server_del_user(user.username)
|
||||
return HttpResponseRedirect('/juser/user_list/')
|
||||
|
||||
|
||||
@require_role(role='admin')
|
||||
def user_del_ajax(request):
|
||||
user_ids = request.POST.get('ids')
|
||||
user_ids = user_ids.split(',')
|
||||
if request.session.get('role_id', '') == 1:
|
||||
if not validate(request, user=user_ids):
|
||||
return "error"
|
||||
|
||||
for user_id in user_ids:
|
||||
user = get_object(User, id=user_id)
|
||||
if user and user.username != 'admin':
|
||||
user.delete()
|
||||
server_del_user(user.username)
|
||||
user_ids = request.GET.get('id', '')
|
||||
user_id_list = user_ids.split(',')
|
||||
for user_id in user_id_list:
|
||||
User.objects.filter(id=user_id).delete()
|
||||
|
||||
return HttpResponse('删除成功')
|
||||
|
||||
|
|
|
@ -80,8 +80,8 @@
|
|||
<label for="groups" class="col-sm-2 control-label">所属主机组</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="groups" name="groups" class="form-control m-b" multiple size="10">
|
||||
{% for g in egroup %}
|
||||
<option type="checkbox" value="{{ g.id }}">{{ g.name }} {% if g.comment %} --- {{ g.comment }} {% endif %}</option>
|
||||
{% for asset_group in asset_group_all %}
|
||||
<option type="checkbox" value="{{ asset_group.id }}">{{ asset_group.name }} {% if asset_group.comment %} --- {{ asset_group.comment }} {% endif %}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
{% for host in hosts %}
|
||||
<option value="{{ host.id }}">{{ host.ip }}</option>
|
||||
{% endfor %}
|
|
@ -24,6 +24,7 @@
|
|||
<div class="ibox-content">
|
||||
<div class="">
|
||||
<a target="_blank" href="/jasset/group_add/" class="btn btn-sm btn-primary "> 添加主机组 </a>
|
||||
<a target="_blank" class="btn btn-sm btn-danger" id="del_check"> 删除所选 </a>
|
||||
<form id="search_form" method="get" action="" class="pull-right mail-search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
|
||||
|
@ -54,15 +55,15 @@
|
|||
{% for asset_group in asset_groups.object_list %}
|
||||
<tr class="gradeX">
|
||||
<td class="text-center" name="id" value="{{ asset_group.id }}" data-editable='false'>
|
||||
<input name="id" value="{{ post.id }}" type="checkbox" class="i-checks">
|
||||
<input name="id" value="{{ asset_group.id }}" type="checkbox" class="i-checks">
|
||||
</td>
|
||||
<td class="text-center"> {{ asset_group.name }} </td>
|
||||
<td class="text-center"> <a href="/jasset/group_detail/?id={{ post.id }}">{{ asset_group.asset_set.count }}</a> </td>
|
||||
<td class="text-center"> <a href="/jasset/group_detail/?id={{ asset_group.id }}">{{ asset_group.asset_set.count }}</a> </td>
|
||||
<td class="text-center"> {{ asset_group.comment }} </td>
|
||||
<td class="text-center">
|
||||
<a href="/jasset/group_detail/?id={{ post.id }}" class="btn btn-xs btn-info">详情</a>
|
||||
<a href="/jasset/group_edit/?id={{ post.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a href="/jasset/group_del/?id={{ post.id }}" class="btn btn-xs btn-danger">删除</a>
|
||||
<a href="/jasset/group_detail/?id={{ asset_group.id }}" class="btn btn-xs btn-info">详情</a>
|
||||
<a href="/jasset/group_edit/?id={{ asset_group.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a value="/jasset/group_del/?id={{ asset_group.id }}" id="del" class="btn btn-xs btn-danger">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -70,8 +71,9 @@
|
|||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<input type="button" id="del_button" class="btn btn-danger btn-sm" name="del_button" value="删除" onclick="del('contents_form')" />
|
||||
<!--<input type="button" id="alter_button" class="btn btn-warning btn-sm" name="alter_button" value="修改" onclick="alter('contents_form')" />-->
|
||||
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
|
||||
Showing {{ asset_groups.start_index }} to {{ asset_groups.end_index }} of {{ p.count }} entries
|
||||
</div>
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
|
@ -81,29 +83,43 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block self_footer_js %}
|
||||
<script>
|
||||
function del(form) {
|
||||
var checkboxes = document.getElementById(form);
|
||||
var id_list = {};
|
||||
var j = 0;
|
||||
for (var i = 0; i < checkboxes.elements.length; i++) {
|
||||
if (checkboxes.elements[i].type == "checkbox" && checkboxes.elements[i].checked == true && checkboxes.elements[i].value != "checkall") {
|
||||
id_list[j] = checkboxes.elements[i].value;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
if (confirm("确定删除")) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/jasset/group_del/?id=multi",
|
||||
data: {"id_list": id_list, "len_list": j},
|
||||
success: function (data) {
|
||||
window.open("/jasset/group_list/", "_self");
|
||||
}
|
||||
$(document).ready(function(){
|
||||
$('#del').click(function(){
|
||||
var row = $(this).closest('tr');
|
||||
$.get(
|
||||
$(this).attr('value'),
|
||||
{},
|
||||
function(data){
|
||||
row.remove();
|
||||
alert(data)
|
||||
}
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('#del_check').click(function(){
|
||||
var check_array = [];
|
||||
if (confirm('确定删除')){
|
||||
$('tr.gradeX input:checked').each(function(){
|
||||
check_array.push($(this).attr('value'))
|
||||
});
|
||||
$.get(
|
||||
'/jasset/group_del/',
|
||||
{id: check_array.join(',')},
|
||||
function(data){
|
||||
$('tr.gradeX input:checked').closest('tr').remove();
|
||||
alert(data);
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<div class="ibox-content">
|
||||
<div class="">
|
||||
<a target="_blank" href="/juser/group_add/" class="btn btn-sm btn-primary "> 添加用户组 </a>
|
||||
<a id="del_btn" class="btn btn-sm btn-danger "> 删除所选组 </a>
|
||||
<a id="del_btn" class="btn btn-sm btn-danger "> 删除所选 </a>
|
||||
<form id="search_form" method="get" action="" class="pull-right mail-search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-sm" id="search_input" name="search" placeholder="Search">
|
||||
|
@ -62,7 +62,7 @@
|
|||
<td class="text-center"> {{ group.comment }} </td>
|
||||
<td class="text-center">
|
||||
<a href="../group_edit/?id={{ group.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a href="../group_del/?id={{ group.id }}" class="btn btn-xs btn-danger">删除</a>
|
||||
<a value="../group_del/?id={{ group.id }}" class="btn btn-xs btn-danger del">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -71,7 +71,7 @@
|
|||
<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
|
||||
Showing {{ user_groups.start_index }} to {{ user_groups.end_index }} of {{ p.count }} entries
|
||||
</div>
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
|
@ -86,14 +86,27 @@
|
|||
{% block self_footer_js %}
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
var check_array = [];
|
||||
$('.del').click(function(){
|
||||
var row = $(this).closest('tr');
|
||||
$.get(
|
||||
$(this).attr('value'),
|
||||
{},
|
||||
function(data){
|
||||
row.remove();
|
||||
alert(data);
|
||||
}
|
||||
|
||||
)
|
||||
});
|
||||
|
||||
$('#del_btn').click(function(){
|
||||
var check_array = [];
|
||||
if (confirm("确定删除")) {
|
||||
$(".gradeX input:checked").each(function() {
|
||||
check_array.push($(this).attr("value"))
|
||||
});
|
||||
$.post("/juser/group_del_ajax/",
|
||||
{group_ids: check_array.join(",")},
|
||||
$.get("/juser/group_del/",
|
||||
{id: check_array.join(",")},
|
||||
function(result){
|
||||
alert(result);
|
||||
$(".gradeX input:checked").closest("tr").remove();
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<a href="../user_detail/?id={{ user.id }}" class="btn btn-xs btn-primary">详情</a>
|
||||
<a href="../user_edit/?id={{ user.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a value="{{ user.uuid }}" class="btn btn-xs btn-warning email">Email</a>
|
||||
<a href="../user_del/?id={{ user.id }}" class="btn btn-xs btn-danger {% if user.username == 'admin' %} disabled {% endif %}">删除</a>
|
||||
<a value="../user_del/?id={{ user.id }}" class="btn btn-xs btn-danger del {% if user.username == 'admin' %} disabled {% endif %}">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -93,32 +93,29 @@
|
|||
{% block self_head_css_js %}
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
{# $(".iframe").on('click', function() {#}
|
||||
{# var url = $(this).attr("value");#}
|
||||
{# $.layer({#}
|
||||
{# type: 2,#}
|
||||
{# title: '用户详情',#}
|
||||
{# maxmin: true,#}
|
||||
{# shift: 'top',#}
|
||||
{# border: [2, 0.3, '#1AB394'],#}
|
||||
{# shade: [0.5, '#000000'],#}
|
||||
{# shadeClose: true,#}
|
||||
{# area: ['800px', '600px'],#}
|
||||
{# iframe: {src: url}#}
|
||||
{# })#}
|
||||
{# });#}
|
||||
$('.del').click(function(){
|
||||
var row = $(this).closest('tr');
|
||||
$.get(
|
||||
$(this).attr('value'),
|
||||
{},
|
||||
function(data){
|
||||
row.remove();
|
||||
alert(data);
|
||||
}
|
||||
)
|
||||
});
|
||||
|
||||
var check_array = [];
|
||||
$('#del_btn').click(function(){
|
||||
var check_array = [];
|
||||
if (confirm("确定删除")) {
|
||||
$(".gradeX input:checked").each(function() {
|
||||
check_array.push($(this).attr("value"))
|
||||
});
|
||||
$.post("/juser/user_del_ajax/",
|
||||
{ids: check_array.join(",")},
|
||||
$.post("/juser/user_del/",
|
||||
{id: check_array.join(",")},
|
||||
function(data){
|
||||
$(".gradeX input:checked").closest("tr").remove();
|
||||
window.open("/juser/user_list/", "_self");
|
||||
alert(data);
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
@ -28,15 +28,15 @@
|
|||
<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="dept_perm_list dept_perm_edit">
|
||||
<a href="/jperm/dept_perm_list/">部门授权</a>
|
||||
<a href="/jperm/user/">用户授权</a>
|
||||
</li>
|
||||
|
||||
<li class="perm_list perm_edit perm_detail">
|
||||
<a href="/jperm/perm_list/">小组授权</a>
|
||||
<a href="/jperm/perm_list/">用户组授权</a>
|
||||
</li>
|
||||
|
||||
<li class="sudo_list sudo_edit sudo_add cmd_list cmd_edit cmd_add sudo_detail">
|
||||
<a href="/jperm/sudo_list/">Sudo授权</a>
|
||||
<a href="/jperm/sudo_list/">命令授权</a>
|
||||
</li>
|
||||
<li class="apply_show online"><a href="/jperm/apply_show/online/">权限审批</a></li>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue