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
c9aab608
Commit
c9aab608
authored
Nov 14, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修复luna不显示多组织资产的问题
parent
641567be
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
api.py
apps/perms/api.py
+10
-6
No files found.
apps/perms/api.py
View file @
c9aab608
...
...
@@ -411,18 +411,22 @@ class UserGrantedNodeChildrenApi(ListAPIView):
util
=
AssetPermissionUtil
(
self
.
request
.
user
)
node_id
=
self
.
request
.
query_params
.
get
(
'id'
)
nodes_granted
=
util
.
get_nodes_with_assets
()
if
nodes_granted
:
first_node
=
sorted
(
nodes_granted
,
reverse
=
True
)[
0
]
else
:
if
not
nodes_granted
:
return
[]
root_nodes
=
[
node
for
node
in
nodes_granted
.
keys
()
if
node
.
is_root
()]
queryset
=
[]
if
node_id
and
node_id
in
[
str
(
node
.
id
)
for
node
in
nodes_granted
]:
node
=
[
node
for
node
in
nodes_granted
if
str
(
node
.
id
)
==
node_id
][
0
]
elif
len
(
root_nodes
)
==
1
:
node
=
root_nodes
[
0
]
node
.
assets_amount
=
len
(
nodes_granted
[
node
])
queryset
.
append
(
node
)
else
:
node
=
first_node
queryset
=
[]
if
node
==
first_node
:
for
node
in
root_nodes
:
node
.
assets_amount
=
len
(
nodes_granted
[
node
])
queryset
.
append
(
node
)
return
queryset
children
=
[]
for
child
in
node
.
get_children
():
...
...
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