mirror of https://github.com/jumpserver/jumpserver
1. 增加授权规则的添加,删除,编辑,详情页面。
2. 修改nav.html中关于授权部分页面。 3. 修改Jasset APP 下的 view,使得数据库中存储的密码是明文。pull/26/head
parent
1eff4ab4ff
commit
6d5d279f61
|
@ -2,7 +2,7 @@ from django.conf.urls import patterns, include, url
|
|||
from jperm.views import *
|
||||
|
||||
urlpatterns = patterns('jperm.views',
|
||||
(r'^user/$', perm_rules),
|
||||
(r'^rule/$', perm_rules),
|
||||
(r'^perm_rule_add/$', perm_rule_add),
|
||||
(r'^perm_rule_detail/$', perm_rule_detail),
|
||||
(r'^perm_rule_edit/$', perm_rule_edit),
|
||||
|
|
|
@ -198,12 +198,16 @@ def perm_rule_delete(request):
|
|||
:param request:
|
||||
:return:
|
||||
"""
|
||||
# 根据rule_id 取得rule对象
|
||||
rule_id = request.GET.get("id")
|
||||
rule_obj = PermRule.objects.get(id=rule_id)
|
||||
|
||||
if request.method == 'POST' and rule_id:
|
||||
return HttpResponse("uncompleted")
|
||||
if request.method == 'POST':
|
||||
# 根据rule_id 取得rule对象
|
||||
rule_id = request.POST.get("id")
|
||||
rule_obj = PermRule.objects.get(id=rule_id)
|
||||
print rule_id, rule_obj
|
||||
print rule_obj.name
|
||||
rule_obj.delete()
|
||||
return HttpResponse(u"删除授权规则:%s" % rule_obj.name)
|
||||
else:
|
||||
return HttpResponse(u"不支持该操作")
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -50,9 +50,9 @@
|
|||
<th class="text-center">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody id="edittbody">
|
||||
{% for rule in rules %}
|
||||
<tr class="gradeX">
|
||||
<tr class="gradeX" id={{ rule.id }}>
|
||||
<td class="text-center"> {{ rule.name }} </td>
|
||||
<td class="text-center">
|
||||
<a href="/jasset/asset_list/?gid={{ user.id }}">{{ rule | rule_member_count:"user" }} </a>
|
||||
|
@ -72,7 +72,7 @@
|
|||
<td class="text-center">
|
||||
<a href="/jperm/perm_rule_detail/?id={{ rule.id }}" class="btn btn-xs btn-primary">详情</a>
|
||||
<a href="/jperm/perm_rule_edit/?id={{ rule.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a onclick="remove_rule({{ rule.id }});" class="btn btn-xs btn-danger">删除</a>
|
||||
<button onclick="remove_rule({{ rule.id }})" class="btn btn-xs btn-danger">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -92,13 +92,29 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
function remove_rule(rule_id){
|
||||
if (confirm("确认删除")) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/jperm/perm_rule_delete/",
|
||||
data: "id=" + rule_id,
|
||||
success: function(msg){
|
||||
alert( "成功: " + msg );
|
||||
var del_row = $('tbody#edittbody>tr#' + rule_id);
|
||||
del_row.remove()
|
||||
},
|
||||
error: function (msg) {
|
||||
alert("失败: " + msg)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function remove_rule(rule_id){
|
||||
|
||||
}
|
||||
|
||||
</script>
|
|
@ -28,7 +28,7 @@
|
|||
<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/user/">用户授权</a>
|
||||
<a href="/jperm/rule/">授权规则</a>
|
||||
</li>
|
||||
|
||||
<li class="perm_list perm_edit perm_detail">
|
||||
|
@ -40,7 +40,7 @@
|
|||
</li>
|
||||
<li class="apply_show online"><a href="/jperm/apply_show/online/">权限审批</a></li>
|
||||
<li class="apply_show online"><a href="/jperm/log/">授权记录</a></li>
|
||||
</ul>
|
||||
</ul>d
|
||||
</li>
|
||||
<li id="jlog">
|
||||
<a href="/jlog/log_list/online/"><i class="fa fa-files-o"></i> <span class="nav-label">日志审计</span><span class="label label-info pull-right"></span></a>
|
||||
|
|
Loading…
Reference in New Issue