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
546393d9
Commit
546393d9
authored
Mar 11, 2015
by
guanghongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--broken encoding: IBM420_ltr
parent
80d4272e
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
135 additions
and
297 deletions
+135
-297
AddUserAsset.py
docs/AddUserAsset.py
+5
-5
models.py
jperm/models.py
+1
-2
views.py
jperm/views.py
+33
-23
mytags.py
jumpserver/templatetags/mytags.py
+9
-0
dept_perm_edit.html
templates/jperm/dept_perm_edit.html
+7
-24
dept_perm_list.html
templates/jperm/dept_perm_list.html
+2
-2
perm_add.html
templates/jperm/perm_add.html
+18
-83
perm_list.html
templates/jperm/perm_list.html
+57
-153
nav.html
templates/nav.html
+3
-5
No files found.
docs/AddUserAsset.py
View file @
546393d9
...
@@ -108,11 +108,11 @@ def test_add_log():
...
@@ -108,11 +108,11 @@ def test_add_log():
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
#
test_add_dept()
test_add_dept
()
#
test_add_group()
test_add_group
()
#
test_add_user()
test_add_user
()
#
test_add_idc()
test_add_idc
()
#
test_add_asset_group()
test_add_asset_group
()
test_add_asset
()
test_add_asset
()
# test_add_log()
# test_add_log()
...
...
jperm/models.py
View file @
546393d9
...
@@ -4,8 +4,7 @@ from jasset.models import Asset, BisGroup
...
@@ -4,8 +4,7 @@ from jasset.models import Asset, BisGroup
class
Perm
(
models
.
Model
):
class
Perm
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
100
)
user_group
=
models
.
ForeignKey
(
UserGroup
)
user_group
=
models
.
ManyToManyField
(
UserGroup
)
asset_group
=
models
.
ManyToManyField
(
BisGroup
)
asset_group
=
models
.
ManyToManyField
(
BisGroup
)
comment
=
models
.
CharField
(
max_length
=
100
)
comment
=
models
.
CharField
(
max_length
=
100
)
...
...
jperm/views.py
View file @
546393d9
...
@@ -42,8 +42,6 @@ def perm_add(request):
...
@@ -42,8 +42,6 @@ def perm_add(request):
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
user_groups
=
UserGroup
.
objects
.
filter
(
id__gt
=
2
)
user_groups
=
UserGroup
.
objects
.
filter
(
id__gt
=
2
)
asset_groups
=
BisGroup
.
objects
.
all
()
asset_groups
=
BisGroup
.
objects
.
all
()
users
=
User
.
objects
.
all
()
assets
=
Asset
.
objects
.
all
()
else
:
else
:
name
=
request
.
POST
.
get
(
'name'
,
''
)
name
=
request
.
POST
.
get
(
'name'
,
''
)
...
@@ -62,39 +60,51 @@ def perm_add(request):
...
@@ -62,39 +60,51 @@ def perm_add(request):
return
render_to_response
(
'jperm/perm_add.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
return
render_to_response
(
'jperm/perm_add.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
def
dept_add_asset
(
dept_list
,
asset_list
):
def
dept_add_asset
(
dept_id
,
asset_list
):
for
dept_id
in
dept_list
:
dept
=
DEPT
.
objects
.
filter
(
id
=
dept_id
)
dept
=
DEPT
.
objects
.
filter
(
id
=
dept_id
)
if
dept
:
if
dept
:
dept
=
dept
[
0
]
dept
=
dept
[
0
]
old_perm_asset
=
[
perm
.
asset
for
perm
in
dept
.
deptperm_set
.
all
()]
for
asset_id
in
asset_list
:
new_perm_asset
=
[]
asset
=
Asset
.
objects
.
filter
(
id
=
asset_id
)
for
asset_id
in
asset_list
:
if
asset
:
asset
=
Asset
.
objects
.
filter
(
id
=
asset_id
)
asset
=
asset
[
0
]
new_perm_asset
.
extend
(
asset
)
DeptPerm
(
dept
=
dept
,
asset
=
asset
)
.
save
()
asset_add
=
[
asset
for
asset
in
new_perm_asset
if
asset
not
in
old_perm_asset
]
asset_del
=
[
asset
for
asset
in
old_perm_asset
if
asset
not
in
new_perm_asset
]
for
asset
in
asset_del
:
DeptPerm
.
objects
.
filter
(
dept
=
dept
,
asset
=
asset
)
.
delete
()
for
asset
in
asset_add
:
DeptPerm
(
dept
=
dept
,
asset
=
asset
)
.
save
()
def
dept_perm_edit
(
request
):
def
dept_perm_edit
(
request
):
header_title
,
path1
,
path2
=
u'部门授权添加'
,
u'授权管理'
,
u'部门授权添加'
header_title
,
path1
,
path2
=
u'部门授权添加'
,
u'授权管理'
,
u'部门授权添加'
if
request
.
method
==
'GET'
:
depts
=
DEPT
.
objects
.
all
()
dept_id
=
request
.
GET
.
get
(
'id'
,
''
)
assets
=
Asset
.
objects
.
all
()
dept
=
DEPT
.
objects
.
filter
(
id
=
dept_id
)
if
request
.
method
==
'POST'
:
if
dept
:
dept_select
=
request
.
POST
.
getlist
(
'dept_select'
)
dept
=
dept
[
0
]
asset_all
=
Asset
.
objects
.
all
()
asset_select
=
[
perm
.
asset
for
perm
in
dept
.
deptperm_set
.
all
()]
assets
=
[
asset
for
asset
in
asset_all
if
asset
not
in
asset_select
]
else
:
dept_id
=
request
.
POST
.
get
(
'dept_id'
)
asset_select
=
request
.
POST
.
getlist
(
'asset_select'
)
asset_select
=
request
.
POST
.
getlist
(
'asset_select'
)
dept_add_asset
(
dept_id
,
asset_select
)
dept_add_asset
(
dept_select
,
asset_select
)
return
HttpResponseRedirect
(
'/jperm/dept_perm_list/'
)
msg
=
'添加成功'
return
render_to_response
(
'jperm/dept_perm_edit.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
return
render_to_response
(
'jperm/dept_perm_edit.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
def
perm_list
(
request
):
def
perm_list
(
request
):
header_title
,
path1
,
path2
=
u'
主机
授权'
,
u'授权管理'
,
u'授权详情'
header_title
,
path1
,
path2
=
u'
小组
授权'
,
u'授权管理'
,
u'授权详情'
keyword
=
request
.
GET
.
get
(
'search'
,
''
)
keyword
=
request
.
GET
.
get
(
'search'
,
''
)
if
keyword
:
if
keyword
:
contact_list
=
Perm
.
objects
.
filter
(
name__icontains
=
keyword
)
contact_list
=
UserGroup
.
objects
.
filter
(
Q
(
name__icontains
=
keyword
)
|
Q
(
comment__icontains
=
keyword
)
)
else
:
else
:
contact_list
=
Perm
.
objects
.
all
()
contact_list
=
UserGroup
.
objects
.
all
()
.
order_by
(
'name'
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
contact_list
,
request
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
contact_list
,
request
)
return
render_to_response
(
'jperm/perm_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
return
render_to_response
(
'jperm/perm_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
...
jumpserver/templatetags/mytags.py
View file @
546393d9
...
@@ -99,6 +99,15 @@ def perm_count(group_id):
...
@@ -99,6 +99,15 @@ def perm_count(group_id):
return
group
.
perm_set
.
count
()
return
group
.
perm_set
.
count
()
@register.filter
(
name
=
'dept_perm_count'
)
def
dept_perm_count
(
dept_id
):
dept
=
DEPT
.
objects
.
filter
(
id
=
dept_id
)
if
dept
:
dept
=
dept
[
0
]
return
dept
.
deptperm_set
.
all
()
.
count
()
return
0
@register.filter
(
name
=
'group_type_to_str'
)
@register.filter
(
name
=
'group_type_to_str'
)
def
group_type_to_str
(
type_name
):
def
group_type_to_str
(
type_name
):
group_types
=
{
group_types
=
{
...
...
templates/jperm/dept_perm_edit.html
View file @
546393d9
...
@@ -39,30 +39,10 @@
...
@@ -39,30 +39,10 @@
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
""
class=
"col-sm-2 control-label"
>
部门
<span
class=
"red-fonts"
>
*
</span></label>
<label
for=
"group_name"
class=
"col-sm-2 control-label"
>
部门
</label>
<div
class=
"col-sm-4"
>
<div
class=
"col-sm-8"
>
<div>
<input
id=
"dept_id"
name=
"dept_id"
type=
"text"
class=
"form-control"
value=
"{{ dept.id }}"
style=
"display: none"
>
<select
id=
"depts"
name=
"depts"
class=
"form-control"
size=
"12"
multiple
>
<input
id=
"dept_name"
name=
"dept_name"
type=
"text"
class=
"form-control"
value=
"{{ dept.name }}"
readonly
>
{% for dept in depts %}
<option
value=
"{{ dept.id }}"
>
{{ dept.name }}
</option>
{% endfor %}
</select>
</div>
</div>
<div
class=
"col-sm-1"
>
<div
class=
"btn-group"
style=
"margin-top: 60px;"
>
<button
type=
"button"
class=
"btn btn-white"
onclick=
"move('depts', 'dept_select')"
><i
class=
"fa fa-chevron-right"
></i></button>
<button
type=
"button"
class=
"btn btn-white"
onclick=
"move('dept_select', 'depts')"
><i
class=
"fa fa-chevron-left"
></i>
</button>
</div>
</div>
<div
class=
"col-sm-3"
>
<div>
<select
id=
"dept_select"
name=
"dept_select"
class=
"form-control m-b"
size=
"12"
multiple
>
</select>
</div>
</div>
</div>
</div>
</div>
...
@@ -90,6 +70,9 @@
...
@@ -90,6 +70,9 @@
<div
class=
"col-sm-3"
>
<div
class=
"col-sm-3"
>
<div>
<div>
<select
id=
"asset_select"
name=
"asset_select"
class=
"form-control m-b"
size=
"12"
multiple
>
<select
id=
"asset_select"
name=
"asset_select"
class=
"form-control m-b"
size=
"12"
multiple
>
{% for asset in asset_select %}
<option
value=
"{{ asset.id }}"
>
{{ asset.ip }}
</option>
{% endfor %}
</select>
</select>
</div>
</div>
</div>
</div>
...
...
templates/jperm/dept_perm_list.html
View file @
546393d9
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
<tr>
<tr>
<th
class=
"text-center"
>
部门名称
</th>
<th
class=
"text-center"
>
部门名称
</th>
<th
class=
"text-center"
>
成员数量
</th>
<th
class=
"text-center"
>
部门
成员数量
</th>
<th
class=
"text-center"
>
授权主机数量
</th>
<th
class=
"text-center"
>
授权主机数量
</th>
<th
class=
"text-center"
>
备注
</th>
<th
class=
"text-center"
>
备注
</th>
<th
class=
"text-center"
>
操作
</th>
<th
class=
"text-center"
>
操作
</th>
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
<tr
class=
"gradeX"
>
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ dept.name }}
</td>
<td
class=
"text-center"
>
{{ dept.name }}
</td>
<td
class=
"text-center"
>
{{ dept.id | dept_member }}
</td>
<td
class=
"text-center"
>
{{ dept.id | dept_member }}
</td>
<td
class=
"text-center"
>
{{ dept.id | dept_
member
}}
</td>
<td
class=
"text-center"
>
{{ dept.id | dept_
perm_count
}}
</td>
<td
class=
"text-center"
>
{{ dept.comment }}
</td>
<td
class=
"text-center"
>
{{ dept.comment }}
</td>
<td
class=
"text-center"
>
<td
class=
"text-center"
>
<a
title=
"[ {{ dept.name }} ] 成员信息"
href=
"../dept_detail/?id={{ dept.id }}"
class=
"iframe btn btn-xs btn-primary"
>
主机
</a>
<a
title=
"[ {{ dept.name }} ] 成员信息"
href=
"../dept_detail/?id={{ dept.id }}"
class=
"iframe btn btn-xs btn-primary"
>
主机
</a>
...
...
templates/jperm/perm_add.html
View file @
546393d9
...
@@ -36,43 +36,21 @@
...
@@ -36,43 +36,21 @@
{% if msg %}
{% if msg %}
<div
class=
"alert alert-success text-center"
>
{{ msg }}
</div>
<div
class=
"alert alert-success text-center"
>
{{ msg }}
</div>
{% endif %}
{% endif %}
<select
multiple=
"multiple"
id=
"user_all"
style=
"display: none;"
>
{% for user in users %}
<option
value=
"{{ user.id }}"
>
{{ user.name }}
</option>
{% endfor %}
</select>
<select
multiple=
"multiple"
id=
"user_group_all"
style=
"display: none;"
>
{% for user_group in user_groups %}
<option
value=
"{{ user_group.id }}"
>
{{ user_group.name }}
</option>
{% endfor %}
</select>
<select
multiple=
"multiple"
id=
"asset_all"
style=
"display: none;"
>
{% for asset in assets %}
<option
value=
"{{ asset.id }}"
>
{{ asset.ip }}
</option>
{% endfor %}
</select>
<select
multiple=
"multiple"
id=
"asset_group_all"
style=
"display: none;"
>
{% for asset_group in asset_groups %}
<option
value=
"{{ asset_group.id }}"
>
{{ asset_group.name }}
</option>
{% endfor %}
</select>
</select>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"form-group"
>
<label
for=
"name"
class=
"col-sm-2 control-label"
>
授权名
<span
class=
"red-fonts"
>
*
</span></label>
<div
class=
"col-sm-8"
>
<input
id=
"name"
name=
"name"
placeholder=
"授权名称"
type=
"text"
class=
"form-control"
>
<span
class=
"help-block m-b-none"
>
取个名字方便辨识
</span>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
""
class=
"col-sm-2 control-label"
>
<label
for=
""
class=
"col-sm-2 control-label"
>
用户组
<span
class=
"red-fonts"
>
*
</span></label>
<select
id=
"user_type"
name=
"user_type"
onchange=
"userChoice(this.value)"
>
<option
value=
"1"
>
用户组
</option>
<option
value=
"0"
>
用户
</option>
</select>
</label>
<div
class=
"col-sm-4"
>
<div
class=
"col-sm-4"
>
<div>
<div>
<select
id=
"user_groups"
name=
"user_groups"
class=
"form-control"
size=
"1
0
"
multiple
>
<select
id=
"user_groups"
name=
"user_groups"
class=
"form-control"
size=
"1
2
"
multiple
>
{% for user_group in user_groups %}
{% for user_group in user_groups %}
<option
value=
"{{ user_group.id }}"
>
{{ user_group.name }}
</option>
<option
value=
"{{ user_group.id }}"
>
{{ user_group.name }}
</option>
{% endfor %}
{% endfor %}
...
@@ -90,7 +68,7 @@
...
@@ -90,7 +68,7 @@
<div
class=
"col-sm-3"
>
<div
class=
"col-sm-3"
>
<div>
<div>
<select
id=
"user_groups_select"
name=
"user_groups_select"
class=
"form-control m-b"
size=
"1
0
"
multiple
>
<select
id=
"user_groups_select"
name=
"user_groups_select"
class=
"form-control m-b"
size=
"1
2
"
multiple
>
</select>
</select>
</div>
</div>
</div>
</div>
...
@@ -99,23 +77,10 @@
...
@@ -99,23 +77,10 @@
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
""
class=
"col-sm-2 control-label"
>
<label
for=
""
class=
"col-sm-2 control-label"
>
主机组
<span
class=
"red-fonts"
>
*
</span></label>
</label>
<div
class=
"col-sm-4"
>
<input
id=
"comment"
name=
"comment"
placeholder=
"过滤"
type=
"text"
class=
"form-control"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
""
class=
"col-sm-2 control-label"
>
<select
id=
"asset_type"
name=
"user_type"
onchange=
"assetChoice(this.value)"
>
<option
value=
"1"
>
主机组
</option>
<option
value=
"0"
>
主机
</option>
</select>
</label>
<div
class=
"col-sm-4"
>
<div
class=
"col-sm-4"
>
<div>
<div>
<select
id=
"asset_groups"
name=
"asset_groups"
class=
"form-control m-b"
size=
"1
0
"
multiple
>
<select
id=
"asset_groups"
name=
"asset_groups"
class=
"form-control m-b"
size=
"1
2
"
multiple
>
{% for asset_group in asset_groups %}
{% for asset_group in asset_groups %}
<option
value=
"{{ asset_group.id }}"
>
{{ asset_group.name }}
</option>
<option
value=
"{{ asset_group.id }}"
>
{{ asset_group.name }}
</option>
{% endfor %}
{% endfor %}
...
@@ -132,7 +97,7 @@
...
@@ -132,7 +97,7 @@
<div
class=
"col-sm-3"
>
<div
class=
"col-sm-3"
>
<div>
<div>
<select
id=
"asset_groups_select"
name=
"asset_groups_select"
class=
"form-control m-b"
size=
"1
0
"
multiple
>
<select
id=
"asset_groups_select"
name=
"asset_groups_select"
class=
"form-control m-b"
size=
"1
2
"
multiple
>
</select>
</select>
</div>
</div>
</div>
</div>
...
@@ -198,43 +163,14 @@ $('#sudoPerm').validator({
...
@@ -198,43 +163,14 @@ $('#sudoPerm').validator({
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
(){
$
(
"#submit_button"
).
click
(
function
(){
$
(
"#submit_button"
).
click
(
function
(){
$
(
'#users_selected option'
).
each
(
function
(){
$
(
'#user_groups_select option'
).
each
(
function
(){
$
(
this
).
prop
(
'selected'
,
true
)
})
$
(
'#asset_groups_select option'
).
each
(
function
(){
$
(
this
).
prop
(
'selected'
,
true
)
$
(
this
).
prop
(
'selected'
,
true
)
})
})
})
})
})
})
function
userChoice
(
value
){
if
(
value
==
"1"
){
$
(
"#user_groups"
).
children
().
each
(
function
(){
$
(
this
).
remove
()});
$
(
"#user_groups_select"
).
children
().
each
(
function
(){
$
(
this
).
remove
()});
$
(
"#user_group_all"
).
children
().
each
(
function
(){
$
(
"#user_groups"
).
append
(
$
(
this
).
clone
())
})
}
else
$
(
"#user_groups"
).
children
().
each
(
function
(){
$
(
this
).
remove
()});
$
(
"#user_groups_select"
).
children
().
each
(
function
(){
$
(
this
).
remove
()});
$
(
"#user_all"
).
children
().
each
(
function
(){
$
(
"#user_groups"
).
append
(
$
(
this
).
clone
())
})
}
function
assetChoice
(
value
){
if
(
value
==
"1"
){
$
(
"#asset_groups"
).
children
().
each
(
function
(){
$
(
this
).
remove
()});
$
(
"#asset_groups_select"
).
children
().
each
(
function
(){
$
(
this
).
remove
()});
$
(
"#asset_group_all"
).
children
().
each
(
function
(){
$
(
"#asset_groups"
).
append
(
$
(
this
).
clone
())
})
}
else
$
(
"#asset_groups"
).
children
().
each
(
function
(){
$
(
this
).
remove
()});
$
(
"#asset_groups_select"
).
children
().
each
(
function
(){
$
(
this
).
remove
()});
$
(
"#asset_all"
).
children
().
each
(
function
(){
$
(
"#asset_groups"
).
append
(
$
(
this
).
clone
())
})
}
</script>
</script>
{% endblock %}
{% endblock %}
\ No newline at end of file
templates/jperm/perm_list.html
View file @
546393d9
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<div
class=
"col-lg-10"
>
<div
class=
"col-lg-10"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<div
class=
"ibox-title"
>
<h5>
授权列表
</h5>
<h5>
查看小组
</h5>
<div
class=
"ibox-tools"
>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
<i
class=
"fa fa-chevron-up"
></i>
...
@@ -29,142 +29,57 @@
...
@@ -29,142 +29,57 @@
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
"ibox-content"
>
<div
class=
"panel blank-panel"
>
<div
class=
""
>
<div
class=
"panel-heading"
>
<a
target=
"_blank"
href=
"/juser/group_add/"
class=
"btn btn-sm btn-primary "
>
添加小组
</a>
<div
class=
"panel-options"
>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<ul
class=
"nav nav-tabs"
>
<div
class=
"input-group"
>
<li
id=
"tab1"
class=
"active"
><a
href=
"/jperm/perm_list/"
>
授权查看
</a></li>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"search"
placeholder=
"Search"
>
<li
style=
"float: right"
>
<div
class=
"input-group-btn"
>
<form
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
<div
class=
"input-group"
>
Search
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"search"
placeholder=
"Search"
>
</button>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
Search
</button>
</div>
</div>
</form>
</li>
</ul>
</div>
</div>
</div>
</div>
</form>
</div>
<div
class=
"panel-body"
>
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
<thead>
<div
class=
"tab-content"
>
<tr>
<div
id=
"tab-1"
class=
"tab-pane active"
>
<th
class=
"text-center"
>
组名
</th>
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
<th
class=
"text-center"
>
所属部门
</th>
<thead>
<th
class=
"text-center"
>
成员数量
</th>
<tr>
<th
class=
"text-center"
>
授权组数量
</th>
<th
class=
"text-center"
>
名称
</th>
<th
class=
"text-center"
>
授权主机数量
</th>
<th
class=
"text-center"
>
用户组
</th>
<th
class=
"text-center"
>
备注
</th>
<th
class=
"text-center"
>
主机组
</th>
<th
class=
"text-center"
>
操作
</th>
<th
class=
"text-center"
>
备注
</th>
</tr>
<th
class=
"text-center"
>
操作
</th>
</thead>
</tr>
<tbody>
</thead>
{% for group in contacts.object_list %}
<tbody
id=
"perm_edit"
>
<tr
class=
"gradeX"
>
{% for perm in contacts.object_list %}
<td
class=
"text-center"
>
{{ group.name }}
</td>
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ group.dept.name }}
</td>
<td
class=
"text-center"
>
{{ perm.name }}
</td>
<td
class=
"text-center"
>
{{ group.id | member_count }}
</td>
<td
class=
"text-center"
>
<td
class=
"text-center"
>
{{ group.id | member_count }}
</td>
{{ perm.user_group.all | group_str2 }}
<td
class=
"text-center"
>
{{ group.id | member_count }}
</td>
</td>
<td
class=
"text-center"
>
{{ group.comment }}
</td>
<td
class=
"text-center"
>
<td
class=
"text-center"
>
{{ perm.asset_group.all | group_str2 }}
<a
href=
"../perm_edit/?id={{ group.id }}"
class=
"btn btn-xs btn-info"
>
授权编辑
</a>
</td>
{#
<a
href=
"../group_del/?id={{ group.id }}"
class=
"btn btn-xs btn-danger"
>
删除
</a>
#}
<td
class=
"text-center"
>
{{ perm.comment }}
</td>
</td>
<td
class=
"text-center"
>
</tr>
<a
title=
"[ {{ group.name }} 授权详情 ]"
href=
"../perm_detail/?id={{ perm.id }}"
class=
" btn btn-xs btn-primary"
>
详情
</a>
{% endfor %}
<a
href=
"../perm_edit/?id={{ perm.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
</tbody>
<a
href=
"../perm_del/?id={{ perm.id }}"
class=
"btn btn-xs btn-danger"
>
删除
</a>
</table>
</td>
<div
class=
"row"
>
</tr>
<div
class=
"col-sm-6"
>
{% endfor %}
<div
class=
"dataTables_info"
id=
"editable_info"
role=
"status"
aria-live=
"polite"
>
</tbody>
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
</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>
{% include 'paginator.html' %}
</div>
</div>
{#
<div
id=
"tab-2"
class=
"tab-pane"
>
#}
{#
<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>
#}
{#
<th
class=
"text-center"
>
操作
</th>
#}
{#
</tr>
#}
{#
</thead>
#}
{#
<tbody
id=
"perm_list"
>
#}
{# {% for user in contacts2.object_list %}#}
{#
<tr
class=
"gradeX"
>
#}
{#
<td
class=
"text-center"
>
{{ user.name }}
</td>
#}
{#
<td
class=
"text-center"
>
{{ user.id | get_role }}
</td>
#}
{#
<td
class=
"text-center"
>
{{ user.username | groups_str }}
</td>
#}
{#
<td
class=
"text-center"
>
{{ user.id | perm_asset_count }}
</td>
#}
{#
<td
class=
"text-center"
>
#}
{#
<a
title=
"[ {{ user.name }} ] 授权详情"
href=
"#"
class=
"btn btn-xs btn-primary"
>
详情
</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 {{ contacts2.start_index }} to {{ contacts2.end_index }} of {{ p2.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 contacts2.has_previous %}#}
{#
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
#}
{#
<a
href=
"?page={{ contacts2.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 page_range2 %}#}
{# {% ifequal current_page 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 contacts2.has_next %}#}
{#
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
#}
{#
<a
href=
"?page={{ contacts2.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>
{% include 'paginator.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -174,30 +89,20 @@
...
@@ -174,30 +89,20 @@
<script>
<script>
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
(){
$
(
".iframe"
).
colorbox
({
iframe
:
true
,
width
:
"70%"
,
height
:
"70%"
});
$
(
".iframe"
).
colorbox
({
iframe
:
true
,
width
:
"70%"
,
height
:
"70%"
});
var
check_array
=
[]
$
(
'#del_btn'
).
click
(
function
(){
$
(
".gradeX input:checked"
).
each
(
function
()
{
check_array
.
push
(
$
(
this
).
attr
(
"value"
))
})
$
(
".gradeX input:checked"
).
closest
(
"tr"
).
remove
()
$
.
post
(
"/juser/group_del_ajax/"
,
{
group_ids
:
check_array
.
join
(
","
)},
function
(
data
){
alert
(
data
)
}
)
})
});
});
$
(
document
).
ready
(
function
(){
$
(
'#search_btn'
).
click
(
function
(){
if
(
$
(
'#tab2'
).
attr
(
'class'
)
==
'active'
){
var
tab
=
'tab2'
}
else
{
var
tab
=
'tab1'
}
var
search
=
$
(
'#search_input'
).
val
()
$
.
post
(
'/jperm/perm_list_ajax/'
,
{
'tab'
:
tab
,
'search'
:
search
},
function
(
data
){
if
(
$
(
'#tab2'
).
attr
(
'class'
)
==
'active'
){
$
(
'#tab-2'
).
html
(
data
)
}
else
{
$
(
'#tab-1'
).
html
(
data
)
}
})
})
})
</script>
</script>
{% endblock %}
{% endblock %}
\ No newline at end of file
templates/nav.html
View file @
546393d9
...
@@ -36,17 +36,15 @@
...
@@ -36,17 +36,15 @@
<li
id=
"jperm"
>
<li
id=
"jperm"
>
<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=
"dept_perm_add"
>
<a
href=
"/jperm/dept_perm_add/"
>
部门授权
</a>
</li>
<li
id=
"dept_perm_list"
>
<li
id=
"dept_perm_list"
>
<a
href=
"/jperm/dept_perm_list/"
>
授权查看
</a>
<a
href=
"/jperm/dept_perm_list/"
>
部门授权
</a>
</li>
</li>
<li
id=
"perm_add"
>
<li
id=
"perm_add"
>
<a
href=
"/jperm/perm_add/"
>
授权添加
</a>
<a
href=
"/jperm/perm_add/"
>
授权添加
</a>
</li>
</li>
<li
id=
"perm_list"
>
<li
id=
"perm_list"
>
<a
href=
"/jperm/perm_list/"
>
授权查看
</a>
<a
href=
"/jperm/perm_list/"
>
小组授权
</a>
</li>
</li>
<li
id=
"sudo_add"
>
<li
id=
"sudo_add"
>
...
...
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