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
ee97144a
Commit
ee97144a
authored
Oct 17, 2019
by
jym503558564
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修复资产授权列表 节点搜索报500错误
parent
01ead7c8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
asset_permission.py
apps/perms/api/asset_permission.py
+8
-5
No files found.
apps/perms/api/asset_permission.py
View file @
ee97144a
...
...
@@ -68,15 +68,18 @@ class AssetPermissionViewSet(viewsets.ModelViewSet):
node_id
=
self
.
request
.
query_params
.
get
(
'node_id'
)
node_name
=
self
.
request
.
query_params
.
get
(
'node'
)
if
node_id
:
node
=
get_object_or_none
(
Node
,
pk
=
node_id
)
node
s
=
Node
.
objects
.
filter
(
pk
=
node_id
)
elif
node_name
:
node
=
get_object_or_none
(
Node
,
nam
e
=
node_name
)
node
s
=
Node
.
objects
.
filter
(
valu
e
=
node_name
)
else
:
return
queryset
if
not
node
:
if
not
node
s
:
return
queryset
.
none
()
nodes
=
node
.
get_ancestors
(
with_self
=
True
)
queryset
=
queryset
.
filter
(
nodes__in
=
nodes
)
related_nodes
=
[]
for
node
in
nodes
:
[
related_nodes
.
append
(
item
)
for
item
in
node
.
get_ancestors
(
with_self
=
True
)]
queryset
=
queryset
.
filter
(
nodes__in
=
related_nodes
)
return
queryset
def
filter_asset
(
self
,
queryset
):
...
...
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