mirror of https://github.com/jumpserver/jumpserver
修改user_edit和 group_edit
parent
b836a28e77
commit
08d42f1c2c
|
@ -13,4 +13,7 @@ urlpatterns = patterns('juser.views',
|
||||||
(r'^user_detail/$', 'user_detail'),
|
(r'^user_detail/$', 'user_detail'),
|
||||||
(r'^user_del/$', 'user_del'),
|
(r'^user_del/$', 'user_del'),
|
||||||
(r'^user_edit/$', 'user_edit'),
|
(r'^user_edit/$', 'user_edit'),
|
||||||
|
(r'^group_detail/$', 'group_detail'),
|
||||||
|
(r'^group_del/$', 'group_del'),
|
||||||
|
(r'^group_edit/$', 'group_edit'),
|
||||||
)
|
)
|
||||||
|
|
|
@ -163,6 +163,38 @@ def group_list(request):
|
||||||
return render_to_response('juser/group_list.html', locals())
|
return render_to_response('juser/group_list.html', locals())
|
||||||
|
|
||||||
|
|
||||||
|
def group_detail(request):
|
||||||
|
group_id = request.GET.get('id', None)
|
||||||
|
if not group_id:
|
||||||
|
return HttpResponseRedirect('/')
|
||||||
|
group = UserGroup.objects.get(id=group_id)
|
||||||
|
return render_to_response('juser/group_detail.html', locals())
|
||||||
|
|
||||||
|
|
||||||
|
def group_del(request):
|
||||||
|
group_id = request.GET.get('id', None)
|
||||||
|
if not group_id:
|
||||||
|
return HttpResponseRedirect('/')
|
||||||
|
group = UserGroup.objects.get(id=group_id)
|
||||||
|
group.delete()
|
||||||
|
return HttpResponseRedirect('/juser/group_list/', locals())
|
||||||
|
|
||||||
|
|
||||||
|
def group_edit(request):
|
||||||
|
error = ''
|
||||||
|
msg = ''
|
||||||
|
header_title, path1, path2 = '淇敼灞炵粍 | Edit Group', 'juser', 'group_edit'
|
||||||
|
if request.method == 'GET':
|
||||||
|
group_id = request.GET.get('id', None)
|
||||||
|
group = UserGroup.objects.get(id=group_id)
|
||||||
|
group_name = group.name
|
||||||
|
comment = group.comment
|
||||||
|
|
||||||
|
return render_to_response('juser/group_add.html', locals())
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def user_list(request):
|
def user_list(request):
|
||||||
user_role = {'SU': u'瓒呯骇绠$悊鍛', 'GA': u'缁勭鐞嗗憳', 'CU': u'鏅氱敤鎴'}
|
user_role = {'SU': u'瓒呯骇绠$悊鍛', 'GA': u'缁勭鐞嗗憳', 'CU': u'鏅氱敤鎴'}
|
||||||
header_title, path1, path2 = '鏌ョ湅鐢ㄦ埛 | Show User', 'juser', 'user_list'
|
header_title, path1, path2 = '鏌ョ湅鐢ㄦ埛 | Show User', 'juser', 'user_list'
|
||||||
|
@ -200,7 +232,7 @@ def user_del(request):
|
||||||
|
|
||||||
def user_edit(request):
|
def user_edit(request):
|
||||||
header_title, path1, path2 = '缂栬緫鐢ㄦ埛 | Edit User', 'juser', 'user_edit'
|
header_title, path1, path2 = '缂栬緫鐢ㄦ埛 | Edit User', 'juser', 'user_edit'
|
||||||
hidden = "hidden"
|
readonly = "readonly"
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
username = request.GET.get('username', None)
|
username = request.GET.get('username', None)
|
||||||
if not username:
|
if not username:
|
||||||
|
|
|
@ -34,6 +34,12 @@
|
||||||
{% if msg %}
|
{% if msg %}
|
||||||
<div class="alert alert-success text-center">{{ msg }}</div>
|
<div class="alert alert-success text-center">{{ msg }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<div class="form-group hidden">
|
||||||
|
<label for="group_id" class="col-sm-2 control-label">ID<span class="red-fonts">*</span></label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input id="group_name" name="group_name" placeholder="Group name" type="text" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="group_name" class="col-sm-2 control-label">缁勫悕<span class="red-fonts">*</span></label>
|
<label for="group_name" class="col-sm-2 control-label">缁勫悕<span class="red-fonts">*</span></label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
{% load mytags %}
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
{% include 'link_css.html' %}
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
body
|
||||||
|
{
|
||||||
|
background: #FFFFFF;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="row">
|
||||||
|
<div class="contact-box">
|
||||||
|
<h2 class="text-center">{{ group.name }} 灞炵粍璇︽儏</h2>
|
||||||
|
<div class="ibox-content">
|
||||||
|
|
||||||
|
<table class="table table-striped table-bordered table-hover " id="editable" >
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-center">灞炵粍</th>
|
||||||
|
<th class="text-center">璇︽儏</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="gradeX">
|
||||||
|
<td class="text-center">ID</td>
|
||||||
|
<td class="text-center">{{ group.id }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="gradeX">
|
||||||
|
<td class="text-center">缁勫悕</td>
|
||||||
|
<td class="text-center">{{ group.name }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="gradeX">
|
||||||
|
<td class="text-center">澶囨敞</td>
|
||||||
|
<td class="text-center">{{ group_comment }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
<div class="ibox-content">
|
<div class="ibox-content">
|
||||||
<div class="">
|
<div class="">
|
||||||
<a target="_blank" href="/juser/user_add/" class="btn btn-sm btn-primary "> 娣诲姞 </a>
|
<a target="_blank" href="/juser/group_add/" class="btn btn-sm btn-primary "> 娣诲姞 </a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="table table-striped table-bordered table-hover " id="editable" >
|
<table class="table table-striped table-bordered table-hover " id="editable" >
|
||||||
|
|
|
@ -35,10 +35,10 @@
|
||||||
{% if msg %}
|
{% if msg %}
|
||||||
<div class="alert alert-success text-center">{{ msg }}</div>
|
<div class="alert alert-success text-center">{{ msg }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="form-group {{ hidden }}">
|
<div class="form-group">
|
||||||
<label for="username" class="col-sm-2 control-label">鐢ㄦ埛鍚<span class="red-fonts">*</span></label>
|
<label for="username" class="col-sm-2 control-label">鐢ㄦ埛鍚<span class="red-fonts">*</span></label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input id="username" name="username" placeholder="Username" type="text" class="form-control" value={{ username }}>
|
<input id="username" name="username" placeholder="Username" type="text" class="form-control" value={{ username }} {{ readonly }}>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="hr-line-dashed"></div>
|
<div class="hr-line-dashed"></div>
|
||||||
|
|
Loading鈥
Reference in New Issue