mirror of https://github.com/jumpserver/jumpserver
授权编辑修改ok
parent
d25a3ce17c
commit
c09d1d25b2
|
@ -7,6 +7,7 @@ urlpatterns = patterns('jperm.views',
|
||||||
# url(r'^blog/', include('blog.urls')),
|
# url(r'^blog/', include('blog.urls')),
|
||||||
|
|
||||||
(r'^perm_edit/$', 'perm_edit'),
|
(r'^perm_edit/$', 'perm_edit'),
|
||||||
(r'^perm_user_show/$', 'perm_user_show'),
|
|
||||||
(r'^perm_list/$', 'perm_list'),
|
(r'^perm_list/$', 'perm_list'),
|
||||||
|
(r'^perm_detail/$', 'perm_detail'),
|
||||||
|
(r'^perm_del/$', 'perm_del'),
|
||||||
)
|
)
|
||||||
|
|
|
@ -61,6 +61,21 @@ def perm_edit(request):
|
||||||
return HttpResponseRedirect('/jperm/perm_list/')
|
return HttpResponseRedirect('/jperm/perm_list/')
|
||||||
|
|
||||||
|
|
||||||
|
def perm_detail(request):
|
||||||
|
user_group_id = request.GET.get('id')
|
||||||
|
user_group = UserGroup.objects.get(id=user_group_id)
|
||||||
|
asset_groups = [perm.asset_group for perm in user_group.perm_set.all()]
|
||||||
|
return render_to_response('jperm/perm_detail.html', locals())
|
||||||
|
|
||||||
|
|
||||||
|
def perm_del(request):
|
||||||
|
user_group_id = request.GET.get('id')
|
||||||
|
user_group = UserGroup.objects.get(id=user_group_id)
|
||||||
|
Perm.objects.filter(user_group=user_group).delete()
|
||||||
|
return HttpResponseRedirect('/jperm/perm_list/')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# def perm_user_host(username, ips):
|
# def perm_user_host(username, ips):
|
||||||
# user = User.objects.get(username=username)
|
# user = User.objects.get(username=username)
|
||||||
# user.perm_set.all().delete()
|
# user.perm_set.all().delete()
|
||||||
|
@ -96,7 +111,7 @@ def perm_edit(request):
|
||||||
# for perm in user.perm_set.all():
|
# for perm in user.perm_set.all():
|
||||||
# host_permed.append(perm.asset)
|
# host_permed.append(perm.asset)
|
||||||
#
|
#
|
||||||
# return render_to_response('jperm/perm_user_detail.html', locals())
|
# return render_to_response('jperm/perm_detail.html', locals())
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# def perm_group_edit(request):
|
# def perm_group_edit(request):
|
||||||
|
|
|
@ -14,29 +14,23 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="contact-box">
|
<div class="contact-box">
|
||||||
<h2 class="text-center">{{ user.name }} 鎺堟潈璇︽儏</h2>
|
<h2 class="text-center">{{ group.name }} 鎺堟潈璇︽儏</h2>
|
||||||
<div class="ibox-content">
|
<div class="ibox-content">
|
||||||
|
|
||||||
<table class="table table-striped table-bordered table-hover " id="editable" >
|
<table class="table table-striped table-bordered table-hover " id="editable" >
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="text-center">ID</th>
|
<th class="text-center">ID</th>
|
||||||
<th class="text-center">IP</th>
|
|
||||||
<th class="text-center">涓绘満缁</th>
|
<th class="text-center">涓绘満缁</th>
|
||||||
<th class="text-center">IDC</th>
|
<th class="text-center">涓绘満鏁伴噺</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for asset in host_permed %}
|
{% for asset_group in asset_groups %}
|
||||||
<tr class="gradeX">
|
<tr class="gradeX">
|
||||||
<td class="text-center">{{ asset.id }}</td>
|
<td class="text-center">{{ asset_group.id }}</td>
|
||||||
<td class="text-center">{{ asset.ip }}</td>
|
<td class="text-center">{{ asset_group.name }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">{{ asset_group.asset_set.count }}</td>
|
||||||
{% for group in asset.bis_group.all %}
|
|
||||||
{{ group }}
|
|
||||||
{% endfor %}
|
|
||||||
</td>
|
|
||||||
<td class="text-center">{{ asset.idc.name }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -61,9 +61,9 @@
|
||||||
<td class="text-center"> {{ group.id|member_count }} </td>
|
<td class="text-center"> {{ group.id|member_count }} </td>
|
||||||
<td class="text-center"> {{ group.id|perm_count }} </td>
|
<td class="text-center"> {{ group.id|perm_count }} </td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a href="../perm_user_detail/?id={{ group.id }}" class="iframe btn btn-xs btn-primary">璇︽儏</a>
|
<a href="../perm_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_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>
|
<a href="../perm_del/?id={{ group.id }}" class="btn btn-xs btn-danger">鍒犻櫎</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading鈥
Reference in New Issue