mirror of https://github.com/jumpserver/jumpserver
修改 chgsudo
parent
f48dd46898
commit
6418033e51
|
@ -1,12 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7.6 (C:/Python27/python.exe)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7.6 (C:/Python27/python.exe)" project-jdk-type="Python SDK" />
|
||||||
<component name="PyConsoleOptionsProvider">
|
|
||||||
<option name="myPythonConsoleState">
|
|
||||||
<console-settings is-module-sdk="true">
|
|
||||||
<option name="myUseModuleSdk" value="true" />
|
|
||||||
</console-settings>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|
|
@ -637,11 +637,13 @@ def chgSudo(request):
|
||||||
msg = ''
|
msg = ''
|
||||||
if request.POST.get('add_host') or request.POST.get('del_host'):
|
if request.POST.get('add_host') or request.POST.get('del_host'):
|
||||||
host = request.POST.get('add_host') if request.POST.get('add_host') else request.POST.get('del_host')
|
host = request.POST.get('add_host') if request.POST.get('add_host') else request.POST.get('del_host')
|
||||||
hosts = host.split(',')
|
hosts = str(host).split(',')
|
||||||
ori_hosts = l.list('entryDN=cn=%s,ou=Sudoers,%s' %
|
ori_hosts = l.list('entryDN=cn=%s,ou=Sudoers,%s' %
|
||||||
(str(username), ldap_base_dn), attr=['sudoHost']).get('sudoHost')
|
(str(username), ldap_base_dn), attr=['sudoHost']).get('sudoHost')
|
||||||
|
|
||||||
if request.POST.get('add_host'):
|
if request.POST.get('add_host'):
|
||||||
|
if not ori_hosts:
|
||||||
|
ori_hosts = []
|
||||||
ori_hosts.extend(hosts)
|
ori_hosts.extend(hosts)
|
||||||
new_hosts = list(set(ori_hosts))
|
new_hosts = list(set(ori_hosts))
|
||||||
else:
|
else:
|
||||||
|
@ -652,10 +654,12 @@ def chgSudo(request):
|
||||||
|
|
||||||
if request.POST.get('add_cmd') or request.POST.get('del_cmd'):
|
if request.POST.get('add_cmd') or request.POST.get('del_cmd'):
|
||||||
cmd = request.POST.get('add_cmd') if request.POST.get('add_cmd') else request.POST.get('del_cmd')
|
cmd = request.POST.get('add_cmd') if request.POST.get('add_cmd') else request.POST.get('del_cmd')
|
||||||
cmds = cmd.split(',')
|
cmds = str(cmd).split(',')
|
||||||
ori_cmds = l.list('entryDN=cn=%s,ou=Sudoers,%s' %
|
ori_cmds = l.list('entryDN=cn=%s,ou=Sudoers,%s' %
|
||||||
(str(username), ldap_base_dn), attr=['sudoCommand']).get('sudoCommand')
|
(str(username), ldap_base_dn), attr=['sudoCommand']).get('sudoCommand')
|
||||||
if request.POST.get('add_cmd'):
|
if request.POST.get('add_cmd'):
|
||||||
|
if not ori_cmds:
|
||||||
|
ori_cmds = []
|
||||||
ori_cmds.extend(cmds)
|
ori_cmds.extend(cmds)
|
||||||
new_cmds = list(set(ori_cmds))
|
new_cmds = list(set(ori_cmds))
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -21,6 +21,18 @@
|
||||||
history.go(-1);
|
history.go(-1);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link href="/static/css/bootstrap.css" rel="stylesheet">
|
||||||
|
<link href="/static/css/main.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<script src="/static/js/main.js"></script>
|
||||||
|
<script src="/static/js/jquery.min.js"></script>
|
||||||
|
|
||||||
|
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
|
||||||
|
<script src="/static/js/bootstrap.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
<fieldset >
|
<fieldset >
|
||||||
<legend>{{ username }}</legend>
|
<legend>{{ username }}</legend>
|
||||||
<b>允许sudo的主机:</b>
|
<b>允许sudo的主机:</b>
|
||||||
<hr />
|
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
{% for host in sudoHost %}
|
{% for host in sudoHost %}
|
||||||
<li class="list-group-item">{{ host }}</li>
|
<li class="list-group-item">{{ host }}</li>
|
||||||
|
@ -11,7 +10,6 @@
|
||||||
</ul>
|
</ul>
|
||||||
<br />
|
<br />
|
||||||
<b>允许的sudo命令:</b>
|
<b>允许的sudo命令:</b>
|
||||||
<hr />
|
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
{% for cmd in sudoCommand %}
|
{% for cmd in sudoCommand %}
|
||||||
<li class="list-group-item">{{ cmd }}</li>
|
<li class="list-group-item">{{ cmd }}</li>
|
||||||
|
|
Loading…
Reference in New Issue