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
ea29305f
Commit
ea29305f
authored
Dec 17, 2015
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of git.coding.net:jumpserver/jumpserver into dev
parents
9fb71ade
7c742bf0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
33 deletions
+44
-33
models.py
jasset/models.py
+1
-1
ansible_api.py
jperm/ansible_api.py
+1
-1
views.py
jperm/views.py
+40
-29
idc_list.html
templates/jasset/idc_list.html
+1
-1
perm_sudo_list.html
templates/jperm/perm_sudo_list.html
+1
-1
No files found.
jasset/models.py
View file @
ea29305f
...
@@ -45,7 +45,7 @@ class IDC(models.Model):
...
@@ -45,7 +45,7 @@ class IDC(models.Model):
phone
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
null
=
True
,
default
=
''
,
verbose_name
=
u'联系电话'
)
phone
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
null
=
True
,
default
=
''
,
verbose_name
=
u'联系电话'
)
address
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
null
=
True
,
default
=
''
,
verbose_name
=
u"机房地址"
)
address
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
null
=
True
,
default
=
''
,
verbose_name
=
u"机房地址"
)
network
=
models
.
TextField
(
blank
=
True
,
null
=
True
,
default
=
''
,
verbose_name
=
u"IP地址段"
)
network
=
models
.
TextField
(
blank
=
True
,
null
=
True
,
default
=
''
,
verbose_name
=
u"IP地址段"
)
date_added
=
models
.
DateField
(
auto_now
=
True
,
default
=
''
,
null
=
True
)
date_added
=
models
.
DateField
(
auto_now
=
True
,
null
=
True
)
operator
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
default
=
''
,
null
=
True
,
verbose_name
=
u"运营商"
)
operator
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
default
=
''
,
null
=
True
,
verbose_name
=
u"运营商"
)
comment
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
default
=
''
,
null
=
True
,
verbose_name
=
u"备注"
)
comment
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
default
=
''
,
null
=
True
,
verbose_name
=
u"备注"
)
...
...
jperm/ansible_api.py
View file @
ea29305f
...
@@ -16,7 +16,7 @@ from passlib.hash import sha512_crypt
...
@@ -16,7 +16,7 @@ from passlib.hash import sha512_crypt
from
django.template.loader
import
get_template
from
django.template.loader
import
get_template
from
django.template
import
Context
from
django.template
import
Context
from
utils
import
get_rand_pass
from
jumpserver.api
import
logger
from
jumpserver.api
import
logger
...
...
jperm/views.py
View file @
ea29305f
...
@@ -53,21 +53,27 @@ def perm_rule_detail(request):
...
@@ -53,21 +53,27 @@ def perm_rule_detail(request):
header_title
,
path1
,
path2
=
"授权规则"
,
"规则管理"
,
"规则详情"
header_title
,
path1
,
path2
=
"授权规则"
,
"规则管理"
,
"规则详情"
# 根据rule_id 取得rule对象
# 根据rule_id 取得rule对象
rule_id
=
request
.
GET
.
get
(
"id"
)
try
:
rule_obj
=
PermRule
.
objects
.
get
(
id
=
rule_id
)
if
request
.
method
==
"GET"
:
user_obj
=
rule_obj
.
user
.
all
()
rule_id
=
request
.
GET
.
get
(
"id"
)
user_group_obj
=
rule_obj
.
user_group
.
all
()
if
not
rule_id
:
asset_obj
=
rule_obj
.
asset
.
all
()
raise
ServerError
(
"Rule Detail - no rule id get"
)
asset_group_obj
=
rule_obj
.
asset_group
.
all
()
rule_obj
=
PermRule
.
objects
.
get
(
id
=
rule_id
)
roles_name
=
[
role
.
name
for
role
in
rule_obj
.
role
.
all
()]
user_obj
=
rule_obj
.
user
.
all
()
user_group_obj
=
rule_obj
.
user_group
.
all
()
# 渲染数据
asset_obj
=
rule_obj
.
asset
.
all
()
roles_name
=
','
.
join
(
roles_name
)
asset_group_obj
=
rule_obj
.
asset_group
.
all
()
rule
=
rule_obj
roles_name
=
[
role
.
name
for
role
in
rule_obj
.
role
.
all
()]
users
=
user_obj
user_groups
=
user_group_obj
# 渲染数据
assets
=
asset_obj
roles_name
=
','
.
join
(
roles_name
)
asset_groups
=
asset_group_obj
rule
=
rule_obj
users
=
user_obj
user_groups
=
user_group_obj
assets
=
asset_obj
asset_groups
=
asset_group_obj
except
ServerError
,
e
:
logger
.
warning
(
e
)
return
my_render
(
'jperm/perm_rule_detail.html'
,
locals
(),
request
)
return
my_render
(
'jperm/perm_rule_detail.html'
,
locals
(),
request
)
...
@@ -349,20 +355,25 @@ def perm_role_detail(request):
...
@@ -349,20 +355,25 @@ def perm_role_detail(request):
# 渲染数据
# 渲染数据
header_title
,
path1
,
path2
=
"系统用户"
,
"系统用户管理"
,
"系统用户详情"
header_title
,
path1
,
path2
=
"系统用户"
,
"系统用户管理"
,
"系统用户详情"
if
request
.
method
==
"GET"
:
try
:
role_id
=
request
.
GET
.
get
(
"id"
)
if
request
.
method
==
"GET"
:
role
=
get_object
(
PermRole
,
id
=
role_id
)
role_id
=
request
.
GET
.
get
(
"id"
)
role_info
=
get_role_info
(
role_id
)
if
not
role_id
:
raise
ServerError
(
"not role id"
)
# 渲染数据
role
=
get_object
(
PermRole
,
id
=
role_id
)
rules
=
role_info
.
get
(
"rules"
)
role_info
=
get_role_info
(
role_id
)
assets
=
role_info
.
get
(
"assets"
)
asset_groups
=
role_info
.
get
(
"asset_groups"
)
# 渲染数据
users
=
role_info
.
get
(
"users"
)
rules
=
role_info
.
get
(
"rules"
)
user_groups
=
role_info
.
get
(
"user_groups"
)
assets
=
role_info
.
get
(
"assets"
)
pushed_asset
,
need_push_asset
=
get_role_push_host
(
get_object
(
PermRole
,
id
=
role_id
))
asset_groups
=
role_info
.
get
(
"asset_groups"
)
users
=
role_info
.
get
(
"users"
)
return
my_render
(
'jperm/perm_role_detail.html'
,
locals
(),
request
)
user_groups
=
role_info
.
get
(
"user_groups"
)
pushed_asset
,
need_push_asset
=
get_role_push_host
(
get_object
(
PermRole
,
id
=
role_id
))
except
ServerError
,
e
:
logger
.
warning
(
e
)
return
my_render
(
'jperm/perm_role_detail.html'
,
locals
(),
request
)
@require_role
(
'admin'
)
@require_role
(
'admin'
)
...
...
templates/jasset/idc_list.html
View file @
ea29305f
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
<td
class=
"text-center"
>
<td
class=
"text-center"
>
<a
href=
"{% url 'idc_edit' %}?id={{ post.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"{% url 'idc_edit' %}?id={{ post.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href
=
"{% url 'idc_del' %}?id={{ post.id }}"
class=
"btn btn-xs btn-danger idc_del"
>
删除
</a>
<a
value
=
"{% url 'idc_del' %}?id={{ post.id }}"
class=
"btn btn-xs btn-danger idc_del"
>
删除
</a>
</td>
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
...
...
templates/jperm/perm_sudo_list.html
View file @
ea29305f
...
@@ -89,7 +89,7 @@ function remove_sudo(sudo_id){
...
@@ -89,7 +89,7 @@ function remove_sudo(sudo_id){
if
(
confirm
(
"确认删除"
))
{
if
(
confirm
(
"确认删除"
))
{
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
"/jperm/sudo/
perm_sudo_delete
/"
,
url
:
"/jperm/sudo/
del
/"
,
data
:
"id="
+
sudo_id
,
data
:
"id="
+
sudo_id
,
success
:
function
(
msg
){
success
:
function
(
msg
){
alert
(
"成功: "
+
msg
);
alert
(
"成功: "
+
msg
);
...
...
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