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
35d9be5c
Commit
35d9be5c
authored
Jan 30, 2015
by
guanghongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
connect.py
parent
c1686d52
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
641 deletions
+11
-641
connect.py
connect.py
+6
-11
views.py
jperm/views.py
+5
-83
perm_group_edit.html
templates/jperm/perm_group_edit.html
+0
-152
perm_list2.htl.html
templates/jperm/perm_list2.htl.html
+0
-194
perm_user_edit.html
templates/jperm/perm_user_edit.html
+0
-139
perm_user_show.html
templates/jperm/perm_user_show.html
+0
-62
No files found.
connect.py
View file @
35d9be5c
...
@@ -25,6 +25,7 @@ django.setup()
...
@@ -25,6 +25,7 @@ django.setup()
from
juser.models
import
User
from
juser.models
import
User
from
jasset.models
import
Asset
from
jasset.models
import
Asset
from
jlog.models
import
Log
from
jlog.models
import
Log
from
jperm.views
import
perm_user_asset
try
:
try
:
import
termios
import
termios
...
@@ -207,15 +208,10 @@ def posix_shell(chan, username, host):
...
@@ -207,15 +208,10 @@ def posix_shell(chan, username, host):
def
get_user_host
(
username
):
def
get_user_host
(
username
):
"""Get the hosts of under the user control."""
"""Get the hosts of under the user control."""
hosts_attr
=
{}
hosts_attr
=
{}
try
:
asset_all
=
perm_user_asset
(
username
=
username
)
user
=
User
.
objects
.
get
(
username
=
username
)
for
asset
in
asset_all
:
except
ObjectDoesNotExist
:
hosts_attr
[
asset
.
ip
]
=
[
asset
.
id
,
asset
.
comment
]
raise
ServerError
(
"Username
\033
[1;31m
%
s
\033
[0m doesn't exist on Jumpserver."
%
username
)
return
hosts_attr
else
:
perm_all
=
user
.
permission_set
.
all
()
for
perm
in
perm_all
:
hosts_attr
[
perm
.
asset
.
ip
]
=
[
perm
.
asset
.
id
,
perm
.
asset
.
comment
]
return
hosts_attr
def
get_connect_item
(
username
,
ip
):
def
get_connect_item
(
username
,
ip
):
...
@@ -234,7 +230,6 @@ def get_connect_item(username, ip):
...
@@ -234,7 +230,6 @@ def get_connect_item(username, ip):
login_type_dict
=
{
login_type_dict
=
{
'L'
:
user
.
ldap_pwd
,
'L'
:
user
.
ldap_pwd
,
'S'
:
user
.
ssh_key_pwd2
,
'P'
:
user
.
ssh_pwd
,
'P'
:
user
.
ssh_pwd
,
}
}
...
@@ -244,7 +239,7 @@ def get_connect_item(username, ip):
...
@@ -244,7 +239,7 @@ def get_connect_item(username, ip):
elif
asset
.
login_type
==
'M'
:
elif
asset
.
login_type
==
'M'
:
username
=
asset
.
username
username
=
asset
.
username
password
=
cryptor
.
decrypt
(
asset
.
password
)
password
=
cryptor
.
decrypt
(
asset
.
password
)
return
username
,
password
,
ip
,
port
return
username
,
password
,
ip
,
port
else
:
else
:
...
...
jperm/views.py
View file @
35d9be5c
...
@@ -25,8 +25,11 @@ def perm_group_update(user_group_name='', user_group_id='', asset_groups_name=''
...
@@ -25,8 +25,11 @@ def perm_group_update(user_group_name='', user_group_id='', asset_groups_name=''
Perm
(
user_group
=
user_group
,
asset_group
=
asset_group
)
.
save
()
Perm
(
user_group
=
user_group
,
asset_group
=
asset_group
)
.
save
()
def
perm_user_asset
(
user_id
):
def
perm_user_asset
(
user_id
=
None
,
username
=
None
):
user
=
User
.
objects
.
get
(
id
=
user_id
)
if
user_id
:
user
=
User
.
objects
.
get
(
id
=
user_id
)
else
:
user
=
User
.
objects
.
get
(
username
=
username
)
user_groups
=
user
.
user_group
.
all
()
user_groups
=
user
.
user_group
.
all
()
perms
=
[]
perms
=
[]
assets
=
[]
assets
=
[]
...
@@ -99,84 +102,3 @@ def perm_asset_detail(request):
...
@@ -99,84 +102,3 @@ 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 perm_user_host(username, ips):
# user = User.objects.get(username=username)
# user.perm_set.all().delete()
# for ip in ips:
# asset = Asset.objects.get(ip=ip)
# Perm.objects.create(user=user, asset=asset)
#
#
# def perm_user_edit(request):
# header_title, path1, path2 = u'授权编辑 | Perm Edit.', u'jperm', u'perm_edit'
# if request.method == 'GET':
# if request.GET.get('id', None):
# user_id = request.GET.get('id')
# user = User.objects.get(id=user_id)
# assets = Asset.objects.all()
# assets_permed = []
# for perm in user.perm_set.all():
# assets_permed.append(perm.asset)
# assets_unperm = list(set(assets)-set(assets_permed))
# return render_to_response('jperm/perm_user_edit.html', locals())
# else:
# host_ips = request.POST.getlist('host_permed', '')
# username = request.POST.get('username')
# perm_user_host(username, host_ips)
#
# return HttpResponseRedirect('/jperm/perm_host/')
#
#
# def perm_user_detail(request):
# user_id = request.GET.get('id', '')
# user = User.objects.get(id=user_id)
# host_permed = []
# for perm in user.perm_set.all():
# host_permed.append(perm.asset)
#
# return render_to_response('jperm/perm_detail.html', locals())
#
#
# def perm_group_edit(request):
# if request.method == 'GET':
# group_id = request.GET.get('id', '')
# group = UserGroup.objects.get(id=group_id)
#
# return render_to_response('jperm/perm_group_edit.html')
#
#
# def perm_add(request):
# header_title, path1, path2 = u'添加授权 | Add User perm.', u'授权管理', u'添加授权'
# if request.method == 'GET':
# username = request.GET.get('username', None)
# if not username:
# return HttpResponseRedirect('/')
#
# user = User.objects.get(username=username)
# permed_hosts = []
# for perm in user.perm_set.all():
# permed_hosts.append(perm.asset)
#
# hosts_all = Asset.objects.all()
# hosts = list(set(hosts_all) - set(permed_hosts))
#
# else:
# username = request.POST.get('username', None)
# host_ids = request.POST.getlist('host_ids', None)
#
# user = User.objects.get(username=username)
# for host_id in host_ids:
# asset = Asset.objects.get(id=host_id)
# perm = Perm(user=user, asset=asset)
# perm.save()
# msg = u'添加成功'
#
# return render_to_response('jperm/perm_add.html', locals())
#
#
# def perm_user_show(request):
# header_title, path1, path2 = u'查看授权用户 | Perm User Detail.', u'授权管理', u'用户详情'
# users = User.objects.all()
# return render_to_response('jperm/perm_user_show.html', locals(),)
templates/jperm/perm_group_edit.html
deleted
100644 → 0
View file @
c1686d52
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
<script
type=
"text/javascript"
>
function
move
(
from
,
to
)
{
$
(
"#"
+
from
+
" option"
).
each
(
function
(){
if
(
$
(
this
).
prop
(
"selected"
)
==
true
)
{
$
(
"#"
+
to
).
append
(
this
);
}
});
}
function
move_all
(
from
,
to
){
$
(
"#"
+
from
).
children
().
each
(
function
(){
$
(
"#"
+
to
).
append
(
this
);
});
}
function
search_host
(
text
){
$
(
"#host_unperm"
).
children
().
each
(
function
(){
$
(
this
).
remove
();});
var
permArray
=
[];
$
(
"#host_permed"
).
children
().
each
(
function
(){
permArray
.
push
(
$
(
this
).
text
());
});
$
(
"#host_all"
).
children
().
each
(
function
(){
if
(
$
(
this
).
text
().
search
(
text
)
!=
-
1
&&
permArray
.
indexOf
(
$
(
this
).
text
())
==
-
1
)
{
$
(
"#host_unperm"
).
append
(
$
(
this
).
clone
())
}
});
}
</script>
{% 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"
>
<!-- title -->
<div
class=
"ibox-title"
>
<h5>
授权编辑表单
<small>
Edit perm of user group
</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=
"#"
>
Config option 1
</a>
</li>
<li><a
href=
"#"
>
Config option 2
</a>
</li>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<!-- end title -->
<div
class=
"ibox-content"
>
<div
class=
"row"
>
<div
class=
"col-sm-5 "
>
<div
class=
"form-group"
>
<label></label>
<input
type=
"text"
id=
"host_filter"
placeholder=
"Search"
class=
"form-control"
value=
""
oninput=
"search_host(this.value)"
>
</div>
</div>
<div
class=
"col-sm-1 "
>
<div
class=
"form-group"
>
<label></label>
</div>
</div>
<div
class=
"col-sm-5 "
>
<div
class=
"form-group"
>
<label></label>
<input
type=
"text"
class=
"form-control"
value=
"{{ group.name }}"
readonly
>
</div>
</div>
</div>
<form
method=
"post"
action=
""
>
<input
type=
"text"
name=
"username"
class=
"form-control"
value=
"{{ group.name }}"
style=
"display: none"
>
<div
class=
"row"
>
<div
class=
"col-sm-5"
><h4>
未授权主机
</h4>
<div>
<select
id=
"host_all"
name=
"host_all"
class=
"form-control"
size=
"10"
multiple
style=
"display: none"
>
{% for asset in assets %}
<option
value=
"{{ asset.ip }}"
>
{{ asset.ip }}
</option>
{% endfor %}
</select>
<select
id=
"host_unperm"
name=
"host_unperm"
class=
"form-control m-b"
size=
"12"
multiple
>
{% for asset in assets_unperm %}
<option
value=
"{{ asset.ip }}"
>
{{ asset.ip }}
</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('host_unperm', 'host_permed')"
><i
class=
"fa fa-chevron-right"
></i></button>
<button
type=
"button"
class=
"btn btn-white"
onclick=
"move('host_permed', 'host_unperm')"
><i
class=
"fa fa-chevron-left"
></i>
</button>
</div>
</div>
<div
class=
"col-sm-5"
><h4>
授权主机
</h4>
<div>
<select
id=
"host_permed"
name=
"host_permed"
class=
"form-control m-b"
size=
"12"
multiple
>
{% for asset in assets_permed %}
<option
value=
"{{ asset.ip }}"
>
{{ asset.ip }}
</option>
{% endfor %}
</select>
</div>
</div>
</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(){$('#host_permed option').each(function(){$(this).prop('selected', true)})})()"
>
确认保存
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
var
str
=
document
.
location
.
pathname
.
split
(
"/"
)[
1
];
var
str1
=
document
.
location
.
pathname
.
split
(
"/"
)[
2
];
$
(
"#"
+
str
).
addClass
(
'active'
);
$
(
"#"
+
str1
).
addClass
(
'active'
);
</script>
{#
<script
type=
"text/javascript"
>
#
}
{
#
$
(
"#host_permed"
).
children
().
each
(
function
(){
#
}
{
#
$
(
"#host_all"
).
append
(
$
(
this
).
clone
());
#
}
{
##
}
{
#
if
(
$
(
this
).
prop
(
"selected"
)
==
false
)
{
#
}
{
#
$
(
"#host_unperm"
).
append
(
this
);
#
}
{
#
}
#
}
{
##
}
{
#
$
(
"#host_all"
).
children
().
each
(
function
(){
$
(
this
).
prop
(
"selected"
,
false
)});
#
}
{
#
});
#
}
{
#
</script>
#}
{% endblock %}
\ No newline at end of file
templates/jperm/perm_list2.htl.html
deleted
100644 → 0
View file @
c1686d52
{% 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 host 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"
>
<div
class=
"panel blank-panel"
>
<div
class=
"panel-heading"
>
<div
class=
"panel-options"
>
<ul
class=
"nav nav-tabs"
>
<li
class=
"active"
><a
data-toggle=
"tab"
href=
"#tab-1"
>
用户授权
</a></li>
<li
class=
""
><a
data-toggle=
"tab"
href=
"#tab-2"
>
用户组授权
</a></li>
</ul>
</div>
</div>
<div
class=
"panel-body"
>
<div
class=
"tab-content"
>
<div
id=
"tab-1"
class=
"tab-pane active"
>
<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>
{% for user in contacts.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ user.username }}
</td>
<td
class=
"text-center"
>
{{ user.name }}
</td>
<td
class=
"text-center"
>
{{ user.username|groups_str }}
</td>
<td
class=
"text-center"
>
{{ user.id|perm_count }}
</td>
<td
class=
"text-center"
>
<a
href=
"../perm_user_detail/?id={{ user.id }}"
class=
"iframe btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"../perm_user_edit/?id={{ user.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</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
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>
</tr>
</thead>
<tbody>
{% for group in contacts2.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ group.name }}
</td>
<td
class=
"text-center"
>
{{ group.comment }}
</td>
<td
class=
"text-center"
>
<a
href=
"../perm_group_detail/?id={{ user.id }}"
class=
"iframe btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"../perm_group_edit/?id={{ user.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</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 p2.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 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>
</div>
</div>
</div>
</div>
<script>
$
(
document
).
ready
(
function
(){
$
(
".iframe"
).
colorbox
({
iframe
:
true
,
width
:
"70%"
,
height
:
"70%"
});
});
</script>
{% endblock %}
\ No newline at end of file
templates/jperm/perm_user_edit.html
deleted
100644 → 0
View file @
c1686d52
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
<script
type=
"text/javascript"
>
function
search_host
(
text
){
$
(
"#host_unperm"
).
children
().
each
(
function
(){
$
(
this
).
remove
();});
var
permArray
=
[];
$
(
"#host_permed"
).
children
().
each
(
function
(){
permArray
.
push
(
$
(
this
).
text
());
});
$
(
"#host_all"
).
children
().
each
(
function
(){
if
(
$
(
this
).
text
().
search
(
text
)
!=
-
1
&&
permArray
.
indexOf
(
$
(
this
).
text
())
==
-
1
)
{
$
(
"#host_unperm"
).
append
(
$
(
this
).
clone
())
}
});
}
</script>
{% 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"
>
<!-- title -->
<div
class=
"ibox-title"
>
<h5>
授权编辑表单
<small>
Edit perm of user
</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=
"#"
>
Config option 1
</a>
</li>
<li><a
href=
"#"
>
Config option 2
</a>
</li>
</ul>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<!-- end title -->
<div
class=
"ibox-content"
>
<div
class=
"row"
>
<div
class=
"col-sm-5 "
>
<div
class=
"form-group"
>
<label></label>
<input
type=
"text"
id=
"host_filter"
placeholder=
"Search"
class=
"form-control"
value=
""
oninput=
"search_host(this.value)"
>
</div>
</div>
<div
class=
"col-sm-1 "
>
<div
class=
"form-group"
>
<label></label>
</div>
</div>
<div
class=
"col-sm-5 "
>
<div
class=
"form-group"
>
<label></label>
<input
type=
"text"
class=
"form-control"
value=
"{{ user.name }}"
readonly
>
</div>
</div>
</div>
<form
method=
"post"
action=
""
>
<input
type=
"text"
name=
"username"
class=
"form-control"
value=
"{{ user.username }}"
style=
"display: none"
>
<div
class=
"row"
>
<div
class=
"col-sm-5"
><h4>
未授权主机
</h4>
<div>
<select
id=
"host_all"
name=
"host_all"
class=
"form-control"
size=
"10"
multiple
style=
"display: none"
>
{% for asset in assets %}
<option
value=
"{{ asset.ip }}"
>
{{ asset.ip }}
</option>
{% endfor %}
</select>
<select
id=
"host_unperm"
name=
"host_unperm"
class=
"form-control m-b"
size=
"12"
multiple
>
{% for asset in assets_unperm %}
<option
value=
"{{ asset.ip }}"
>
{{ asset.ip }}
</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('host_unperm', 'host_permed')"
><i
class=
"fa fa-chevron-right"
></i></button>
<button
type=
"button"
class=
"btn btn-white"
onclick=
"move('host_permed', 'host_unperm')"
><i
class=
"fa fa-chevron-left"
></i>
</button>
</div>
</div>
<div
class=
"col-sm-5"
><h4>
授权主机
</h4>
<div>
<select
id=
"host_permed"
name=
"host_permed"
class=
"form-control m-b"
size=
"12"
multiple
>
{% for asset in assets_permed %}
<option
value=
"{{ asset.ip }}"
>
{{ asset.ip }}
</option>
{% endfor %}
</select>
</div>
</div>
</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(){$('#host_permed option').each(function(){$(this).prop('selected', true)})})()"
>
确认保存
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
var
str
=
document
.
location
.
pathname
.
split
(
"/"
)[
1
];
var
str1
=
document
.
location
.
pathname
.
split
(
"/"
)[
2
];
$
(
"#"
+
str
).
addClass
(
'active'
);
$
(
"#"
+
str1
).
addClass
(
'active'
);
</script>
{#
<script
type=
"text/javascript"
>
#
}
{
#
$
(
"#host_permed"
).
children
().
each
(
function
(){
#
}
{
#
$
(
"#host_all"
).
append
(
$
(
this
).
clone
());
#
}
{
##
}
{
#
if
(
$
(
this
).
prop
(
"selected"
)
==
false
)
{
#
}
{
#
$
(
"#host_unperm"
).
append
(
this
);
#
}
{
#
}
#
}
{
##
}
{
#
$
(
"#host_all"
).
children
().
each
(
function
(){
$
(
this
).
prop
(
"selected"
,
false
)});
#
}
{
#
});
#
}
{
#
</script>
#}
{% endblock %}
\ No newline at end of file
templates/jperm/perm_user_show.html
deleted
100644 → 0
View file @
c1686d52
{% 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 user 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"
style=
"display: block;"
>
<form
method=
"post"
action=
""
>
<table
class=
"table table-hover"
>
<thead>
<tr>
<th>
ID
</th>
<th>
添加授权
</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>
{{ user.id }}
</td>
<td>
{{ user.username }}
</td>
<td><a
href=
"../perm_list/?username={{ user.username }}"
>
查看权限
</a></td>
</tr>
{% endfor %}
</tbody>
</table>
<div
class=
"form-group"
>
<div
class=
"col-sm-4 col-sm-offset-2"
>
<button
class=
"btn btn-white"
type=
"submit"
>
取消
</button>
<button
id=
"submit_button"
class=
"btn btn-primary"
type=
"submit"
>
确认删除
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
\ 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