mirror of https://github.com/jumpserver/jumpserver
Merge branch 'dev' of git.coding.net:jumpserver/jumpserver into dev
commit
49fbae4fad
|
@ -350,6 +350,7 @@ def perm_role_edit(request):
|
||||||
role_pass = CRYPTOR.decrypt(role.password)
|
role_pass = CRYPTOR.decrypt(role.password)
|
||||||
sudo_all = PermSudo.objects.all()
|
sudo_all = PermSudo.objects.all()
|
||||||
role_sudos = role.sudo.all()
|
role_sudos = role.sudo.all()
|
||||||
|
sudo_all = PermSudo.objects.all()
|
||||||
if request.method == "GET":
|
if request.method == "GET":
|
||||||
return my_render('jperm/perm_role_edit.html', locals(), request)
|
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_sudo_names = request.POST.getlist("sudo_name")
|
||||||
role_sudos = [PermSudo.objects.get(id=sudo_id) for sudo_id in role_sudo_names]
|
role_sudos = [PermSudo.objects.get(id=sudo_id) for sudo_id in role_sudo_names]
|
||||||
key_content = request.POST.get("role_key", "")
|
key_content = request.POST.get("role_key", "")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not role:
|
if not role:
|
||||||
raise ServerError('角色用户不能存在')
|
raise ServerError('角色用户不能存在')
|
||||||
|
@ -379,6 +381,7 @@ def perm_role_edit(request):
|
||||||
role.name = role_name
|
role.name = role_name
|
||||||
role.comment = role_comment
|
role.comment = role_comment
|
||||||
role.sudo = role_sudos
|
role.sudo = role_sudos
|
||||||
|
|
||||||
role.save()
|
role.save()
|
||||||
msg = u"更新系统角色: %s" % role.name
|
msg = u"更新系统角色: %s" % role.name
|
||||||
return HttpResponseRedirect('/jperm/role/')
|
return HttpResponseRedirect('/jperm/role/')
|
||||||
|
|
|
@ -9,7 +9,7 @@ log = debug
|
||||||
host = 127.0.0.1
|
host = 127.0.0.1
|
||||||
port = 3306
|
port = 3306
|
||||||
user = jumpserver
|
user = jumpserver
|
||||||
password = mysql234
|
password = mysql1234
|
||||||
database = jumpserver
|
database = jumpserver
|
||||||
|
|
||||||
[websocket]
|
[websocket]
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
<div class="hr-line-dashed"></div>
|
<div class="hr-line-dashed"></div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="sudo" class="col-sm-2 control-label">角色Sudo命令<span class="red-fonts">*</span></label>
|
<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">
|
<select name="sudo_name" data-placeholder="请选择Sudo别名" class="chosen-select form-control m-b" multiple tabindex="2">
|
||||||
{% for sudo in sudo_all %}
|
{% for sudo in sudo_all %}
|
||||||
<option value="{{ sudo.id }}" {% if sudo in role_sudos %} selected {% endif %}>{{ sudo.name }}</option>
|
<option value="{{ sudo.id }}" {% if sudo in role_sudos %} selected {% endif %}>{{ sudo.name }}</option>
|
||||||
|
@ -66,6 +66,7 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="hr-line-dashed"></div>
|
<div class="hr-line-dashed"></div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="role_comment" class="col-sm-2 control-label">备注</label>
|
<label for="role_comment" class="col-sm-2 control-label">备注</label>
|
||||||
|
|
Loading…
Reference in New Issue