Merge branch 'dev' of git.coding.net:jumpserver/jumpserver into dev

pull/26/head
ibuler 2015-11-29 16:38:48 +08:00
commit 49fbae4fad
3 changed files with 6 additions and 2 deletions

View File

@ -350,6 +350,7 @@ def perm_role_edit(request):
role_pass = CRYPTOR.decrypt(role.password)
sudo_all = PermSudo.objects.all()
role_sudos = role.sudo.all()
sudo_all = PermSudo.objects.all()
if request.method == "GET":
return my_render('jperm/perm_role_edit.html', locals(), request)
@ -361,6 +362,7 @@ def perm_role_edit(request):
role_sudo_names = request.POST.getlist("sudo_name")
role_sudos = [PermSudo.objects.get(id=sudo_id) for sudo_id in role_sudo_names]
key_content = request.POST.get("role_key", "")
try:
if not role:
raise ServerError('角色用户不能存在')
@ -379,6 +381,7 @@ def perm_role_edit(request):
role.name = role_name
role.comment = role_comment
role.sudo = role_sudos
role.save()
msg = u"更新系统角色: %s" % role.name
return HttpResponseRedirect('/jperm/role/')

View File

@ -9,7 +9,7 @@ log = debug
host = 127.0.0.1
port = 3306
user = jumpserver
password = mysql234
password = mysql1234
database = jumpserver
[websocket]

View File

@ -58,7 +58,7 @@
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="sudo" class="col-sm-2 control-label">角色Sudo命令<span class="red-fonts">*</span></label>
<div class="col-sm-8" id="sudo_name">
<div class="col-sm-8">
<select name="sudo_name" data-placeholder="请选择Sudo别名" class="chosen-select form-control m-b" multiple tabindex="2">
{% for sudo in sudo_all %}
<option value="{{ sudo.id }}" {% if sudo in role_sudos %} selected {% endif %}>{{ sudo.name }}</option>
@ -66,6 +66,7 @@
</select>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="role_comment" class="col-sm-2 control-label">备注</label>