Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
1eff4ab4
Commit
1eff4ab4
authored
Nov 13, 2015
by
yumaojun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add edit, detail page
parent
1aed3b4d
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
369 additions
and
244 deletions
+369
-244
urls.py
jperm/urls.py
+4
-2
views.py
jperm/views.py
+47
-10
mytags.py
jumpserver/templatetags/mytags.py
+40
-0
perm_rule_detail.html
templates/jperm/perm_rule_detail.html
+116
-5
perm_rule_edit.html
templates/jperm/perm_rule_edit.html
+148
-223
perm_rules.html
templates/jperm/perm_rules.html
+14
-4
No files found.
jperm/urls.py
View file @
1eff4ab4
...
...
@@ -3,8 +3,10 @@ from jperm.views import *
urlpatterns
=
patterns
(
'jperm.views'
,
(
r'^user/$'
,
perm_rules
),
(
r'^perm_user_edit/$'
,
perm_rule_add
),
(
r'^perm_user_detail/$'
,
perm_rule_detail
),
(
r'^perm_rule_add/$'
,
perm_rule_add
),
(
r'^perm_rule_detail/$'
,
perm_rule_detail
),
(
r'^perm_rule_edit/$'
,
perm_rule_edit
),
(
r'^perm_rule_delete/$'
,
perm_rule_delete
),
(
r'^group/$'
,
perm_group_list
),
(
r'^perm_group_edit/$'
,
perm_group_edit
),
(
r'^log/$'
,
log
),
...
...
jperm/views.py
View file @
1eff4ab4
...
...
@@ -58,10 +58,18 @@ def perm_rule_detail(request):
2. include 部分:{
%
include 'nav_cat_bar.html'
%
}
rander_nav 为渲染数据
"""
data_nav
=
{
"header_title"
:
"
用户授权"
,
"path1"
:
"授权管理"
,
"path2"
:
"用户
详情"
}
data_nav
=
{
"header_title"
:
"
授权规则"
,
"path1"
:
"授权管理"
,
"path2"
:
"规则
详情"
}
# 待实现
render_data
=
updates_dict
(
data_nav
)
# 根据rule_id 取得rule对象
rule_id
=
request
.
GET
.
get
(
"id"
)
rule_obj
=
PermRule
.
objects
.
get
(
id
=
rule_id
)
user_obj
=
rule_obj
.
user
.
all
()
asset_obj
=
rule_obj
.
asset
.
all
()
roles_name
=
[
role
.
name
for
role
in
rule_obj
.
role
.
all
()]
data_content
=
{
"roles_name"
:
','
.
join
(
roles_name
),
"rule"
:
rule_obj
,
"users"
:
user_obj
,
"assets"
:
asset_obj
}
render_data
=
updates_dict
(
data_nav
,
data_content
)
return
my_render
(
'jperm/perm_rule_detail.html'
,
render_data
,
request
)
...
...
@@ -73,7 +81,7 @@ def perm_rule_add(request):
:param request:
:return:
"""
data_nav
=
{
"header_title"
:
"
用户授权"
,
"path1"
:
"授权管理"
,
"path2"
:
"添加授权
规则"
}
data_nav
=
{
"header_title"
:
"
授权规则"
,
"path1"
:
"授权管理"
,
"path2"
:
"添加
规则"
}
if
request
.
method
==
'GET'
:
# 获取所有 用户,用户组,资产,资产组,用户角色, 用于添加授权规则
...
...
@@ -150,23 +158,52 @@ def perm_rule_add(request):
else
:
return
HttpResponse
(
"add rule failed"
)
@require_role
(
'admin'
)
def
perm_rule_
lis
t
(
request
):
def
perm_rule_
edi
t
(
request
):
"""
list rules
:param request:
:return:
"""
data_nav
=
{
"header_title"
:
"用户授权"
,
"path1"
:
"授权管理"
,
"path2"
:
"查看授权规则"
}
data_nav
=
{
"header_title"
:
"授权规则"
,
"path1"
:
"授权管理"
,
"path2"
:
"编辑规则"
}
# 根据rule_id 取得rule对象
rule_id
=
request
.
GET
.
get
(
"id"
)
rule_obj
=
PermRule
.
objects
.
get
(
id
=
rule_id
)
user_id
=
request
.
GET
.
get
(
'id'
,
''
)
user
=
get_object
(
User
,
id
=
user_id
)
if
request
.
method
==
'GET'
and
user
:
if
request
.
method
==
'GET'
and
rule_id
:
# 获取所有的rule对象
rules
=
PermRule
.
obects
.
all
()
users
=
rule_obj
.
user
.
all
()
user_groups
=
rule_obj
.
user_group
.
all
()
assets
=
rule_obj
.
asset
.
all
()
asset_groups
=
rule_obj
.
asset_group
.
all
()
roles
=
rule_obj
.
role
.
all
()
data_content
=
{
"users"
:
users
,
"user_groups"
:
user_groups
,
"assets"
:
assets
,
"asset_groups"
:
asset_groups
,
"roles"
:
roles
}
render_data
=
updates_dict
(
data_nav
,
data_content
)
return
my_render
(
'jperm/perm_rule_edit.html'
,
render_data
,
request
)
elif
request
.
method
==
'POST'
and
rule_id
:
return
HttpResponse
(
"uncompleted"
)
@require_role
(
'admin'
)
def
perm_rule_delete
(
request
):
"""
use to delete rule
:param request:
:return:
"""
# 根据rule_id 取得rule对象
rule_id
=
request
.
GET
.
get
(
"id"
)
rule_obj
=
PermRule
.
objects
.
get
(
id
=
rule_id
)
if
request
.
method
==
'POST'
and
rule_id
:
return
HttpResponse
(
"uncompleted"
)
...
...
jumpserver/templatetags/mytags.py
View file @
1eff4ab4
...
...
@@ -127,6 +127,13 @@ def result2bool(result=''):
@register.filter
(
name
=
'rule_member_count'
)
def
rule_member_count
(
instance
,
member
):
"""
instance is a rule object,
use to get the number of the members
:param instance:
:param member:
:return:
"""
member
=
getattr
(
instance
,
member
)
counts
=
member
.
all
()
.
count
()
return
str
(
counts
)
...
...
@@ -134,11 +141,44 @@ def rule_member_count(instance, member):
@register.filter
(
name
=
'rule_member_name'
)
def
rule_member_name
(
instance
,
member
):
"""
instance is a rule object,
use to get the name of the members
:param instance:
:param member:
:return:
"""
member
=
getattr
(
instance
,
member
)
names
=
member
.
all
()
return
names
@register.filter
(
name
=
'user_which_groups'
)
def
user_which_group
(
user
,
member
):
"""
instance is a user object,
use to get the group of the user
:param instance:
:param member:
:return:
"""
member
=
getattr
(
user
,
member
)
names
=
[
members
.
name
for
members
in
member
.
all
()]
return
','
.
join
(
names
)
@register.filter
(
name
=
'asset_which_groups'
)
def
asset_which_group
(
asset
,
member
):
"""
instance is a user object,
use to get the group of the user
:param instance:
:param member:
:return:
"""
member
=
getattr
(
asset
,
member
)
names
=
[
members
.
name
for
members
in
member
.
all
()]
return
','
.
join
(
names
)
templates/jperm/perm_rule_detail.html
View file @
1eff4ab4
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
{% include 'nav_cat_bar.html' %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-lg-10
"
>
<div
class=
"col-lg-4
"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
还未实现...
</h5
>
<span
class=
"label label-primary"
><b>
{{ rule.name }}
</b></span
>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
...
...
@@ -16,15 +18,123 @@
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
<li><a
href=
"#"
></a>
</li>
<li><a
href=
"#"
></a>
</li>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<div>
<div
class=
"text-left"
>
<table
class=
"table"
>
<tr>
<td
class=
"text-navy"
>
ID
</td>
<td>
{{ rule.id }}
</td>
</tr>
<tr>
<td
class=
"text-navy"
>
名称
</td>
<td>
{{ rule.name }}
</td>
</tr>
<tr>
<td
class=
"text-navy"
>
时间
</td>
<td>
{{ rule.date_added }}
</td>
</tr>
<tr>
<td
class=
"text-navy"
>
角色
</td>
<td>
{{ roles_name }}
</td>
</tr>
<tr>
<td
class=
"text-navy"
>
激活
</td>
<td>
是
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div
class=
"col-lg-4"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
授权用户/用户组
</h5>
<div
class=
"ibox-content"
>
<div>
<div
class=
"text-left"
>
<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>
{% for user in users %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ user.name }}
</td>
<td
class=
"text-center"
>
{{ user | user_which_groups:"group" }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<div
class=
"ibox-content inspinia-timeline"
>
</div>
</div>
</div>
<div
class=
"col-lg-4"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
授权主机/主机组
</h5>
<div
class=
"ibox-content"
>
<div>
<div
class=
"text-left"
>
<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>
{% for asset in assets %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ asset.ip }}
</td>
<td
class=
"text-center"
>
{{ asset | asset_which_groups:"group" }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div
class=
"ibox-content inspinia-timeline"
>
</div>
</div>
</div>
</div>
<script>
$
(
document
).
ready
(
function
(){
$
(
'#show'
).
click
(
function
(){
$
(
'#last'
).
css
(
'display'
,
'none'
);
$
(
'#all'
).
css
(
'display'
,
'block'
);
})
})
</script>
{% endblock %}
\ No newline at end of file
templates/jperm/perm_rule_edit.html
View file @
1eff4ab4
{% extends 'base.html' %}
{% block self_head_css_js %}
<link
href=
"/static/css/plugins/datapicker/datepicker3.css"
rel=
"stylesheet"
>
<link
href=
"/static/css/plugins/chosen/chosen.css"
rel=
"stylesheet"
>
<script
src=
"/static/js/plugins/chosen/chosen.jquery.js"
></script>
{% endblock %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
{% include 'nav_cat_bar.html' %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-sm-4
"
>
<div
class=
"col-lg-10
"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
未授权资源和资源组
</h5>
<h5>
填写基本信息
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
...
...
@@ -21,264 +25,185 @@
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
""
>
{#
<a
target=
"_blank"
href=
"/juser/user_add/"
class=
"btn btn-sm btn-primary "
>
添加用户
</a>
#}
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"search"
placeholder=
"Search"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
- 搜索 -
</button>
</div>
</div>
</form>
<form
method=
"post"
id=
"userForm"
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=
"username"
class=
"col-sm-2 control-label"
>
授权名称
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-8"
>
<input
id=
"rulename"
name=
"rulename"
placeholder=
"RuleName"
type=
"text"
class=
"form-control"
{%
if
error
%}
value=
"{{ username }}"
{%
endif
%}
>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"user"
class=
"col-sm-2 control-label"
>
用户
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-8"
>
<select
name=
"user"
data-placeholder=
"用户名"
class=
"chosen-select form-control m-b"
multiple
tabindex=
"2"
>
{% for user in users %}
<option
value=
"{{ user.name }}"
>
{{ user.name }}
</option>
{% endfor %}
</select>
</div>
<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>
{% for user in users.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
192.168.10.128
</td>
<td
class=
"text-center"
>
<div
class=
"btn-group"
data-toggle=
"buttons"
>
<label
class=
"btn btn-xs btn-default"
>
<input
type=
"checkbox"
>
SA
</label>
</div>
<div
class=
"btn-group"
data-toggle=
"buttons"
>
<label
class=
"btn btn-xs btn-default"
>
<input
type=
"checkbox"
>
DBA
</label>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"usergroup"
class=
"col-sm-2 control-label"
>
用户组
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-8"
>
<select
name=
"usergroup"
data-placeholder=
"请选择用户组"
class=
"chosen-select form-control m-b"
multiple
tabindex=
"2"
>
{% for user_group in user_groups %}
<option
value=
"{{ user_group.name }}"
>
{{ user_group.name }}
</option>
{% endfor %}
</select>
</div>
<div
class=
"btn-group"
data-toggle=
"buttons"
>
<label
class=
"btn btn-xs btn-default"
>
<input
type=
"checkbox"
>
DEV
</label>
</div>
</td>
</tr>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"asset"
class=
"col-sm-2 control-label"
>
资产
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-8"
>
<select
name=
"asset"
data-placeholder=
"请选择资产"
class=
"chosen-select form-control m-b"
multiple
tabindex=
"2"
>
{% for asset in assets %}
<option
value=
"{{ asset.ip }}"
>
{{ asset.ip }}
</option>
{% endfor %}
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_info"
id=
"editable_info"
role=
"status"
aria-live=
"polite"
>
Showing {{ users.start_index }} to {{ users.end_index }} of {{ p.count }} entries
</div>
</select>
</div>
{% include 'paginator.html' %}
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"assetgroup"
class=
"col-sm-2 control-label"
>
资产组
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-8"
>
<select
name=
"assetgroup"
data-placeholder=
"请选择资产组"
class=
"chosen-select form-control m-b"
multiple
tabindex=
"2"
>
{% for asset_group in asset_groups %}
<option
value=
"{{ asset_group.name }}"
>
{{ asset_group.name }}
</option>
{% endfor %}
</select>
</div>
</div>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
授权资源和资源组
</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>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"role"
class=
"col-sm-2 control-label"
>
角色
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-8"
>
<select
name=
"role"
data-placeholder=
"请选择角色"
class=
"chosen-select form-control m-b"
multiple
tabindex=
"2"
>
{% for role in roles %}
<option
value=
"{{ role.name }}"
>
{{ role.name }}
</option>
{% endfor %}
</select>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
""
>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"search"
placeholder=
"Search"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
- 搜索 -
</button>
</div>
</div>
</form>
</div>
<div
class=
"hr-line-dashed"
></div>
<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>
{% for user in users.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ user.name }}
</td>
<td
class=
"text-center"
>
<a
href=
"../perm_user_detail/?id={{ user.id }}"
class=
"btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"../perm_user_edit/?id={{ user.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 {{ users.start_index }} to {{ users.end_index }} of {{ p.count }} entries
</div>
<div
class=
"form-group"
>
<label
for=
"j_group"
class=
"col-sm-2 control-label"
>
使用密码
</label>
<div
class=
"col-sm-1"
>
<div
class=
"radio i-checks"
>
<label>
<input
type=
"checkbox"
value=
"0"
id=
"use_password"
name=
"use_password"
>
</label>
</div>
{% include 'paginator.html' %}
</div>
</div>
</div>
</div>
<div
class=
"col-sm-3"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
未授权资源和资源组
</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>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
<div
class=
"form-group"
id=
"admin_account_password"
style=
"display: none"
>
<label
class=
"col-sm-1 control-label"
>
密码
<span
class=
"red-fonts"
>
*
</span>
</label>
<div
class=
"col-sm-4"
>
<input
type=
"password"
name=
"password"
class=
"form-control"
>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
""
>
{#
<a
target=
"_blank"
href=
"/juser/user_add/"
class=
"btn btn-sm btn-primary "
>
添加用户
</a>
#}
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"search"
placeholder=
"Search"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
- 搜索 -
</button>
</div>
</div>
</form>
</div>
<div
class=
"hr-line-dashed"
></div>
<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>
{% for user in users.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
192.168.10.128
</td>
<td
class=
"text-center"
>
<div
class=
"btn-group"
data-toggle=
"buttons"
>
<label
class=
"btn btn-xs btn-default"
>
<input
type=
"checkbox"
>
SA
</label>
</div>
<div
class=
"btn-group"
data-toggle=
"buttons"
>
<label
class=
"btn btn-xs btn-default"
>
<input
type=
"checkbox"
>
DBA
</label>
</div>
<div
class=
"btn-group"
data-toggle=
"buttons"
>
<label
class=
"btn btn-xs btn-default"
>
<input
type=
"checkbox"
>
DEV
<div
class=
"form-group"
>
<label
for=
"j_group"
class=
"col-sm-2 control-label"
>
使用秘钥
</label>
<div
class=
"col-sm-1"
>
<div
class=
"radio i-checks"
>
<label>
<input
type=
"checkbox"
value=
"1"
id=
"use_publicKey"
name=
"use_publicKey"
>
</label>
</div>
</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 {{ users.start_index }} to {{ users.end_index }} of {{ p.count }} entries
</div>
</div>
{% include 'paginator.html' %}
<div
class=
"form-group"
id=
"admin_account_publicKey"
style=
"display: none"
>
<label
class=
"col-sm-1 control-label"
>
秘钥
<span
class=
"red-fonts"
>
*
</span>
</label>
<div
class=
"col-sm-4"
>
<input
type=
"password"
name=
"password"
class=
"form-control"
>
</div>
</div>
</div>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
授权资源和资源组
</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>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<label
for=
"comment"
class=
"col-sm-2 control-label"
>
备注
</label>
<div
class=
"col-sm-8"
>
<input
id=
"comment"
name=
"comment"
placeholder=
"Comment"
type=
"text"
class=
"form-control"
{%
if
error
%}
value=
"{{ username }}"
{%
endif
%}
>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
""
>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"search"
placeholder=
"Search"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
- 搜索 -
</button>
<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>
<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>
{% for user in users.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ user.name }}
</td>
<td
class=
"text-center"
>
<a
href=
"../perm_user_detail/?id={{ user.id }}"
class=
"btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"../perm_user_edit/?id={{ user.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 {{ users.start_index }} to {{ users.end_index }} of {{ p.count }} entries
</div>
</div>
{% include 'paginator.html' %}
</div>
</div>
{% endblock %}
{% block self_footer_js %}
<script>
$
(
document
).
ready
(
function
(){
$
(
"input.role"
).
click
(
function
(){
if
(
$
(
"input.role[value=GA]"
).
is
(
":checked"
)){
$
(
"#admin_groups"
).
css
(
"display"
,
'none'
);
}
else
{
</div>
</div>
</div>
</div>
$
(
"#admin_groups"
).
css
(
"display"
,
'block'
);
}
});
$
(
'#use_password'
).
click
(
function
(){
if
(
$
(
this
).
is
(
':checked'
)){
$
(
'#admin_account_password'
).
css
(
'display'
,
'block'
)
}
else
{
$
(
'#admin_account_password'
).
css
(
'display'
,
'none'
)
}
});
$
(
'#use_publicKey'
).
click
(
function
(){
if
(
$
(
this
).
is
(
':checked'
)){
$
(
'#admin_account_publicKey'
).
css
(
'display'
,
'block'
)
}
else
{
$
(
'#admin_account_publicKey'
).
css
(
'display'
,
'none'
)
}
});
});
var
config
=
{
'.chosen-select'
:
{},
'.chosen-select-deselect'
:
{
allow_single_deselect
:
true
},
'.chosen-select-no-single'
:
{
disable_search_threshold
:
10
},
'.chosen-select-no-results'
:
{
no_results_text
:
'Oops, nothing found!'
},
'.chosen-select-width'
:
{
width
:
"95%"
}
};
for
(
var
selector
in
config
)
{
$
(
selector
).
chosen
(
config
[
selector
]);
}
</script>
<script
src=
"/static/js/cropper/cropper.min.js"
></script>
<script
src=
"/static/js/datapicker/bootstrap-datepicker.js"
></script>
{% endblock %}
templates/jperm/perm_rules.html
View file @
1eff4ab4
...
...
@@ -24,7 +24,7 @@
<div
class=
"ibox-content"
>
<div
class=
""
>
<a
target=
"_blank"
href=
"/jperm/perm_
user_edit
/"
class=
"btn btn-sm btn-primary "
>
添加规则
</a>
<a
target=
"_blank"
href=
"/jperm/perm_
rule_add
/"
class=
"btn btn-sm btn-primary "
>
添加规则
</a>
<a
id=
"del_btn"
class=
"btn btn-sm btn-danger "
>
删除所选
</a>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
...
...
@@ -70,9 +70,9 @@
<a
href=
"/jasset/group_list/?gid={{ user.id }}"
>
{{ rule | rule_member_count:"role" }}
</a>
</td>
<td
class=
"text-center"
>
<a
href=
"
../perm_user_detail/?id={{ user
.id }}"
class=
"btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"
../perm_user_edit/?id={{ user
.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"../perm_user_edit/?id={{ user.id }}
"
class=
"btn btn-xs btn-danger"
>
删除
</a>
<a
href=
"
/jperm/perm_rule_detail/?id={{ rule
.id }}"
class=
"btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"
/jperm/perm_rule_edit/?id={{ rule
.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
onclick=
"remove_rule({{ rule.id }});
"
class=
"btn btn-xs btn-danger"
>
删除
</a>
</td>
</tr>
{% endfor %}
...
...
@@ -93,3 +93,12 @@
</div>
{% endblock %}
<script
type=
"text/javascript"
>
function
remove_rule
(
rule_id
){
}
</script>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment