修改sudo授权

pull/6/head
guanghongwei 2015-02-09 08:40:54 +08:00
parent 75979e3999
commit b9e2c9aa95
8 changed files with 577 additions and 80 deletions

View File

@ -13,4 +13,7 @@ urlpatterns = patterns('jperm.views',
(r'^perm_del/$', 'perm_del'), (r'^perm_del/$', 'perm_del'),
(r'^perm_asset_detail/$', 'perm_asset_detail'), (r'^perm_asset_detail/$', 'perm_asset_detail'),
(r'^sudo_list/$', 'sudo_list'), (r'^sudo_list/$', 'sudo_list'),
(r'^sudo_add/$', 'sudo_add'),
(r'^cmd_add/$', 'cmd_add'),
(r'^cmd_list/$', 'cmd_list'),
) )

View File

@ -4,8 +4,9 @@ from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect, HttpResponse from django.http import HttpResponseRedirect, HttpResponse
from juser.models import User, UserGroup from juser.models import User, UserGroup
from jasset.models import Asset, BisGroup from jasset.models import Asset, BisGroup
from jperm.models import Perm, SudoPerm from jperm.models import Perm, SudoPerm, CmdGroup
from django.core.paginator import Paginator, EmptyPage, InvalidPage from django.core.paginator import Paginator, EmptyPage, InvalidPage
from django.db.models import Q
def perm_group_update(user_group_name='', user_group_id='', asset_groups_name='', asset_groups_id=''): def perm_group_update(user_group_name='', user_group_id='', asset_groups_name='', asset_groups_id=''):
@ -137,12 +138,99 @@ def perm_asset_detail(request):
return render_to_response('jperm/perm_asset_detail.html', locals()) return render_to_response('jperm/perm_asset_detail.html', locals())
def user_asset_cmd_groups_get(user_groups_select, asset_groups_select, cmd_groups_select):
user_groups_select_list = []
asset_groups_select_list = []
cmd_groups_select_list = []
for user_group_id in user_groups_select:
user_groups_select_list.append(UserGroup.objects.get(id=user_group_id))
for asset_group_id in asset_groups_select:
asset_groups_select_list.append(BisGroup.objects.get(id=asset_group_id))
for cmd_group_id in cmd_groups_select:
cmd_groups_select_list.append(CmdGroup.objects.get(id=cmd_group_id))
return user_groups_select_list, asset_groups_select_list, cmd_groups_select_list
def sudo_db_add(user_groups_select, asset_groups_select, cmd_groups_select, comment):
user_groups_select_list, asset_groups_select_list, cmd_groups_select_list = \
user_asset_cmd_groups_get(user_groups_select, asset_groups_select, cmd_groups_select)
sudo_perm = SudoPerm(comment=comment)
sudo_perm.save()
sudo_perm.user_group = user_groups_select_list
sudo_perm.asset_group = asset_groups_select_list
sudo_perm.cmd_group = cmd_groups_select_list
def sudo_ldap_add(user_groups_select, asset_groups_select, cmd_groups_select):
user_groups_select_list, asset_groups_select_list, cmd_groups_select_list = \
user_asset_cmd_groups_get(user_groups_select, asset_groups_select, cmd_groups_select)
def sudo_add(request):
header_title, path1, path2 = u'Sudo授权 | Perm Sudo Add.', u'jperm', u'sudo_add'
user_groups = UserGroup.objects.filter(Q(type='A') | Q(type='P')).order_by('type')
asset_groups = BisGroup.objects.all().order_by('type')
cmd_groups = CmdGroup.objects.all()
if request.method == 'POST':
user_groups_select = request.POST.getlist('user_groups_select')
asset_groups_select = request.POST.getlist('asset_groups_select')
cmd_groups_select = request.POST.getlist('cmd_groups_select')
comment = request.POST.get('comment', '')
sudo_db_add(user_groups_select, asset_groups_select, cmd_groups_select, comment)
msg = '添加成功'
return render_to_response('jperm/sudo_add.html', locals())
def sudo_list(request): def sudo_list(request):
header_title, path1, path2 = u'Sudo授权 | Perm Sudo Detail.', u'jperm', u'sudo_list' header_title, path1, path2 = u'Sudo授权 | Perm Sudo Detail.', u'jperm', u'sudo_list'
sudo_perms = contact_list = SudoPerm.objects.all() sudo_perms = contact_list2 = SudoPerm.objects.all()
users = contact_list2 = User.objects.all().order_by('id')
p = paginator = Paginator(contact_list, 10)
p2 = paginator2 = Paginator(contact_list2, 10) p2 = paginator2 = Paginator(contact_list2, 10)
user_groups = UserGroup.objects.filter(Q(type='A') | Q(type='P'))
asset_groups = BisGroup.objects.all()
cmd_groups = CmdGroup.objects.all()
try:
page = int(request.GET.get('page', '1'))
except ValueError:
page = 1
try:
contacts2 = paginator2.page(page)
except (EmptyPage, InvalidPage):
contacts2 = paginator2.page(paginator2.num_pages)
return render_to_response('jperm/sudo_list.html', locals())
def cmd_add(request):
header_title, path1, path2 = u'sudo命令添加 | Sudo Cmd Add.', u'jperm', u'sudo_cmd_add'
if request.method == 'POST':
name = request.POST.get('name')
cmd = ','.join(request.POST.get('cmd').split())
comment = request.POST.get('comment')
CmdGroup.objects.create(name=name, cmd=cmd, comment=comment)
msg = u'命令组添加成功'
return render_to_response('jperm/sudo_cmd_add.html', locals())
def cmd_list(request):
header_title, path1, path2 = u'sudo命令查看 | Sudo Cmd List.', u'jperm', u'sudo_cmd_list'
cmd_groups = contact_list = CmdGroup.objects.all()
p = paginator = Paginator(contact_list, 10)
try: try:
page = int(request.GET.get('page', '1')) page = int(request.GET.get('page', '1'))
except ValueError: except ValueError:
@ -150,10 +238,7 @@ def sudo_list(request):
try: try:
contacts = paginator.page(page) contacts = paginator.page(page)
contacts2 = paginator2.page(page)
except (EmptyPage, InvalidPage): except (EmptyPage, InvalidPage):
contacts = paginator.page(paginator.num_pages) contacts = paginator.page(paginator.num_pages)
contacts2 = paginator2.page(paginator2.num_pages) return render_to_response('jperm/sudo_cmd_list.html', locals())
return render_to_response('jperm/sudo_list.html', locals())

View File

@ -1,4 +1,4 @@
@import url("//fonts.useso.com/css?family=Open+Sans:300,400,600,700&lang=en"); /*@import url("//fonts.useso.com/css?family=Open+Sans:300,400,600,700&lang=en");*/
h1, h1,
h2, h2,

View File

@ -0,0 +1,149 @@
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-10">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5> Sudo授权 <small> show sudo perm info.</small> </h5>
<div class="ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-wrench"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="#">未启用 1</a>
</li>
<li><a href="#">未启用 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<form id="sudoPerm" method="post" class="form-horizontal" action="">
{% if error %}
<div class="alert alert-warning text-center">{{ error }}</div>
{% endif %}
{% if msg %}
<div class="alert alert-success text-center">{{ msg }}</div>
{% endif %}
<div class="row">
<div class="col-sm-5"><h4>用户组</h4>
<div>
<select id="user_groups" name="user_groups" class="form-control" size="5" multiple>
{% for user_group in user_groups %}
<option value="{{ user_group.id }}">{{ user_group.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-sm-1">
<div class="btn-group" style="margin-top: 50px;">
<button type="button" class="btn btn-white" onclick="move('user_groups', 'user_groups_select')"><i class="fa fa-chevron-right"></i></button>
<button type="button" class="btn btn-white" onclick="move('user_groups_select', 'user_groups')"><i class="fa fa-chevron-left"></i> </button>
</div>
</div>
<div class="col-sm-5"><h4>授权用户组</h4>
<div>
<select id="user_groups_select" name="user_groups_select" class="form-control m-b" size="5" multiple>
</select>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="row">
<div class="col-sm-5"><h4>主机组</h4>
<div>
<select id="asset_groups" name="asset_groups" class="form-control m-b" size="5" multiple>
{% for asset_group in asset_groups %}
<option value="{{ asset_group.id }}">{{ asset_group.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-sm-1">
<div class="btn-group" style="margin-top: 50px;">
<button type="button" class="btn btn-white" onclick="move('asset_groups', 'asset_groups_select')"><i class="fa fa-chevron-right"></i></button>
<button type="button" class="btn btn-white" onclick="move('asset_groups_select', 'asset_groups')"><i class="fa fa-chevron-left"></i> </button>
</div>
</div>
<div class="col-sm-5"><h4>授权主机组</h4>
<div>
<select id="asset_groups_select" name="asset_groups_select" class="form-control m-b" size="5" multiple>
</select>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="row">
<div class="col-sm-5"><h4>命令组</h4>
<div>
<select id="cmd_groups" name="cmd_groups" class="form-control m-b" size="5" multiple>
{% for cmd_group in cmd_groups %}
<option value="{{ cmd_group.id }}">{{ cmd_group.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-sm-1">
<div class="btn-group" style="margin-top: 50px;">
<button type="button" class="btn btn-white" onclick="move('cmd_groups', 'cmd_groups_select')"><i class="fa fa-chevron-right"></i></button>
<button type="button" class="btn btn-white" onclick="move('cmd_groups_select', 'cmd_groups')"><i class="fa fa-chevron-left"></i> </button>
</div>
</div>
<div class="col-sm-5"><h4>命令组</h4>
<div>
<select id="cmd_groups_select" name="cmd_groups_select" class="form-control m-b" size="5" multiple>
</select>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="group_name" class="col-sm-2 control-label">备注</label>
<div class="col-sm-8">
<input id="comment" name="comment" placeholder="备注说明" type="text" class="form-control">
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="row">
<div class="form-group">
<div class="col-sm-4 col-sm-offset-2">
<button class="btn btn-white" type="submit">取消</button>
<button class="btn btn-primary" type="submit" onclick="javascript: (function(){$('#sudoPerm option').each(function(){$(this).prop('selected', true)})})()">确认保存</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,117 @@
{% extends 'base.html' %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-10">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>填写基本信息 <small> Fill Cmd info.</small></h5>
<div class="ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-wrench"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="#">未启用 1</a>
</li>
<li><a href="#">未启用 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<form id="cmdForm" method="post" class="form-horizontal" action="">
{% if error %}
<div class="alert alert-warning text-center">{{ error }}</div>
{% endif %}
{% if msg %}
<div class="alert alert-success text-center">{{ msg }}</div>
{% endif %}
<div class="form-group">
<label for="group_name" class="col-sm-2 control-label">组名<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<input id="name" name="name" placeholder="Group name" type="text" class="form-control">
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="group_type" class="col-sm-2 control-label">命令<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<textarea id='cmd' name='cmd' class="form-control" rows="10" placeholder="命令"></textarea>
<span class="help-block m-b-none">
输入命令一行一个
</span>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="group_name" class="col-sm-2 control-label">备注<span class="red-fonts">*</span></label>
<div class="col-sm-8">
<input id="comment" name="comment" placeholder="备注说明" type="text" class="form-control">
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-2">
<button class="btn btn-white" type="reset">取消</button>
<button id="submit_button" class="btn btn-primary" type="submit">确认保存</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$('#groupForm').validator({
timely: 2,
theme: "yellow_right_effect",
fields: {
"group_name": {
rule: "required",
tip: "输入组名",
ok: "",
msg: {required: "必须填写!"}
},
"group_type": {
rule: "checked",
tip: "选择组类型",
ok: "",
msg: {required: "至少选择一个组!"}
}
},
valid: function(form) {
form.submit();
}
});
function change_type(type){
$.post('/juser/group_add_ajax/',
{'type': type},
function(data){
$('#users').html(data)
})
}
$(document).ready(function(){
$("#submit_button").click(function(){
$('#users_selected option').each(function(){
$(this).prop('selected', true)
})
})
})
</script>
{% endblock %}

View File

@ -0,0 +1,110 @@
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-10">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5> 查看分组 <small> show group info.</small> </h5>
<div class="ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-wrench"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="#">未启用 1</a>
</li>
<li><a href="#">未启用 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<div class="">
<a target="_blank" href="/jperm/cmd_add/" class="btn btn-sm btn-primary "> 添加 </a>
</div>
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
<th class="text-center">组名</th>
<th class="text-center">命令</th>
<th class="text-center">备注</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody>
{% for group in contacts.object_list %}
<tr class="gradeX">
<td class="text-center"> {{ group.name }} </td>
<td class="text-center"> {{ group.cmd }} </td>
<td class="text-center"> {{ group.comment }} </td>
<td class="text-center">
<a title="[ {{ group.name }} ] 成员信息" href="../group_detail/?id={{ group.id }}" class="iframe btn btn-xs btn-primary">成员</a>
<a href="../group_edit/?id={{ group.id }}" class="btn btn-xs btn-info">编辑</a>
<a href="../group_del/?id={{ group.id }}" class="btn btn-xs btn-danger">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="row">
<div class="col-sm-6">
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
</div>
</div>
<div class="col-sm-6">
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
<ul class="pagination" style="margin-top: 0; float: right">
{% if contacts.has_previous %}
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
<a href="?page={{ contacts.previous_page_number }}">Previous</a>
</li>
{% else %}
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
<a href="#">Previous</a>
</li>
{% endif %}
{% for page in p.page_range %}
{% ifequal offset1 page %}
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
{% else %}
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
{% endifequal %}
{% endfor %}
{% if contacts.has_next %}
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
<a href="?page={{ contacts.next_page_number }}">Next</a>
</li>
{% else %}
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
<a href="#">Next</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$(".iframe").colorbox({iframe:true, width:"70%", height:"70%"});
});
</script>
{% endblock %}

View File

@ -29,11 +29,16 @@
</div> </div>
<div class="ibox-content"> <div class="ibox-content">
<div class="" style="margin-left: 15px;">
<a target="_blank" href="/jperm/cmd_add/" class="btn btn-sm btn-primary "> 添加命令组 </a>
<a target="_blank" href="/jperm/cmd_list/" class="btn btn-sm btn-primary "> 查看命令组 </a>
</div>
<div class="panel blank-panel"> <div class="panel blank-panel">
<div class="panel-heading"> <div class="panel-heading">
<div class="panel-options"> <div class="panel-options">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li id="tab1" class="active"><a data-toggle="tab" href="#tab-1">授权编辑</a></li> <li id="tab1" class="active"><a data-toggle="tab" href="#tab-1">添加授权</a></li>
<li id="tab2" class=""><a data-toggle="tab" href="#tab-2">查看授权</a></li> <li id="tab2" class=""><a data-toggle="tab" href="#tab-2">查看授权</a></li>
<li style="float: right"> <li style="float: right">
<form method="get" action="" class="pull-right mail-search"> <form method="get" action="" class="pull-right mail-search">
@ -55,80 +60,107 @@
<div class="tab-content"> <div class="tab-content">
<div id="tab-1" class="tab-pane active"> <div id="tab-1" class="tab-pane active">
<table class="table table-striped table-bordered table-hover " id="editable" > <form id="sudoPerm" method="post" class="form-horizontal" action="">
<thead> {% if error %}
<tr> <div class="alert alert-warning text-center">{{ error }}</div>
<th class="text-center">用户(组)</th> {% endif %}
<th class="text-center">主机(组)</th> {% if msg %}
<th class="text-center">命令(组)</th> <div class="alert alert-success text-center">{{ msg }}</div>
<th class="text-center">操作</th> {% endif %}
</tr> <div class="row">
</thead> <div class="col-sm-5"><h4>用户组</h4>
<tbody id="perm_edit"> <div>
{% for sudo_perm in contacts.object_list %} <select id="user_groups" name="user_groups" class="form-control" size="5" multiple>
<tr class="gradeX"> {% for user_group in user_groups %}
<td class="text-center"> <option value="{{ user_group.id }}">{{ user_group.name }}</option>
{% for user_group in sudo_perm.user_group %} {% endfor %}
{{ user_group.name }} </select>
{% endfor %} </div>
</td> </div>
<td class="text-center">
{% for asset_group in sudo_perm.asset_group %} <div class="col-sm-1">
{{ asset_group.name }} <div class="btn-group" style="margin-top: 50px;">
{% endfor %} <button type="button" class="btn btn-white" onclick="move('user_groups', 'user_groups_select')"><i class="fa fa-chevron-right"></i></button>
</td> <button type="button" class="btn btn-white" onclick="move('user_groups_select', 'user_groups')"><i class="fa fa-chevron-left"></i> </button>
<td class="text-center"> </div>
{% for cmd_group in sudo_perm.cmd_group %} </div>
{{ cmd_group.name }}
{% endfor %} <div class="col-sm-5"><h4>授权用户组</h4>
</td> <div>
<td class="text-center"> <select id="user_groups_select" name="user_groups_select" class="form-control m-b" size="5" multiple>
<a title="[ {{ group.name }} 授权详情 ]" href="../perm_detail/?id={{ group.id }}" class="iframe btn btn-xs btn-primary">详情</a> </select>
<a href="../perm_edit/?id={{ group.id }}" class="btn btn-xs btn-info">编辑</a> </div>
<a href="../perm_del/?id={{ group.id }}" class="btn btn-xs btn-danger">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="row">
<div class="col-sm-6">
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
</div> </div>
</div> </div>
<div class="col-sm-6">
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate"> <div class="hr-line-dashed"></div>
<ul class="pagination" style="margin-top: 0; float: right">
{% if contacts.has_previous %} <div class="row">
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous"> <div class="col-sm-5"><h4>主机组</h4>
<a href="?page={{ contacts.previous_page_number }}">Previous</a> <div>
</li> <select id="asset_groups" name="asset_groups" class="form-control m-b" size="5" multiple>
{% else %} {% for asset_group in asset_groups %}
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous"> <option value="{{ asset_group.id }}">{{ asset_group.name }}</option>
<a href="#">Previous</a> {% endfor %}
</li> </select>
{% endif %} </div>
{% for page in p.page_range %}
{% ifequal offset1 page %}
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
{% else %}
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
{% endifequal %}
{% endfor %}
{% if contacts.has_next %}
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
<a href="?page={{ contacts.next_page_number }}">Next</a>
</li>
{% else %}
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
<a href="#">Next</a>
</li>
{% endif %}
</ul>
</div> </div>
<div class="col-sm-1">
<div class="btn-group" style="margin-top: 50px;">
<button type="button" class="btn btn-white" onclick="move('asset_groups', 'asset_groups_select')"><i class="fa fa-chevron-right"></i></button>
<button type="button" class="btn btn-white" onclick="move('asset_groups_select', 'asset_groups')"><i class="fa fa-chevron-left"></i> </button>
</div>
</div>
<div class="col-sm-5"><h4>授权主机组</h4>
<div>
<select id="asset_groups_select" name="asset_groups_select" class="form-control m-b" size="5" multiple>
</select>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="row">
<div class="col-sm-5"><h4>命令组</h4>
<div>
<select id="cmd_groups" name="cmd_groups" class="form-control m-b" size="5" multiple>
{% for cmd_group in cmd_groups %}
<option value="{{ cmd_group.id }}">{{ cmd_group.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-sm-1">
<div class="btn-group" style="margin-top: 50px;">
<button type="button" class="btn btn-white" onclick="move('cmd_groups', 'cmd_groups_select')"><i class="fa fa-chevron-right"></i></button>
<button type="button" class="btn btn-white" onclick="move('cmd_groups_select', 'cmd_groups')"><i class="fa fa-chevron-left"></i> </button>
</div>
</div>
<div class="col-sm-5"><h4>命令组</h4>
<div>
<select id="cmd_groups_select" name="cmd_groups_select" class="form-control m-b" size="5" multiple>
</select>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="row">
<div class="form-group">
<div class="col-sm-4 col-sm-offset-2">
<button class="btn btn-white" type="submit">取消</button>
<button class="btn btn-primary" type="submit" onclick="javascript: (function(){$('#sudoPerm option').each(function(){$(this).prop('selected', true)})})()">确认保存</button>
</div> </div>
</div> </div>
</div>
</form>
</div> </div>
<div id="tab-2" class="tab-pane"> <div id="tab-2" class="tab-pane">

View File

@ -33,7 +33,8 @@
<a href="#"><i class="fa fa-edit"></i> <span class="nav-label">授权管理</span><span class="fa arrow"></span></a> <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"> <ul class="nav nav-second-level">
<li id="perm_list"><a href="/jperm/perm_list/">主机授权</a></li> <li id="perm_list"><a href="/jperm/perm_list/">主机授权</a></li>
<li id="perm_sudo"><a href="/jperm/sudo_list/">Sudo授权</a></li> <li id="perm_sudo"><a href="/jperm/sudo_add/">Sudo添加</a></li>
<li id="perm_sudo"><a href="/jperm/sudo_list/">Sudo查看</a></li>
</ul> </ul>
</li> </li>
<li id="jlog"> <li id="jlog">