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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
api.py
apps/perms/api.py
+11
-7
No files found.
apps/perms/api.py
View file @
c9aab608
...
@@ -411,18 +411,22 @@ class UserGrantedNodeChildrenApi(ListAPIView):
...
@@ -411,18 +411,22 @@ class UserGrantedNodeChildrenApi(ListAPIView):
util
=
AssetPermissionUtil
(
self
.
request
.
user
)
util
=
AssetPermissionUtil
(
self
.
request
.
user
)
node_id
=
self
.
request
.
query_params
.
get
(
'id'
)
node_id
=
self
.
request
.
query_params
.
get
(
'id'
)
nodes_granted
=
util
.
get_nodes_with_assets
()
nodes_granted
=
util
.
get_nodes_with_assets
()
if
nodes_granted
:
if
not
nodes_granted
:
first_node
=
sorted
(
nodes_granted
,
reverse
=
True
)[
0
]
else
:
return
[]
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
]:
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
]
node
=
[
node
for
node
in
nodes_granted
if
str
(
node
.
id
)
==
node_id
][
0
]
else
:
elif
len
(
root_nodes
)
==
1
:
node
=
first_node
node
=
root_nodes
[
0
]
queryset
=
[]
if
node
==
first_node
:
node
.
assets_amount
=
len
(
nodes_granted
[
node
])
node
.
assets_amount
=
len
(
nodes_granted
[
node
])
queryset
.
append
(
node
)
queryset
.
append
(
node
)
else
:
for
node
in
root_nodes
:
node
.
assets_amount
=
len
(
nodes_granted
[
node
])
queryset
.
append
(
node
)
return
queryset
children
=
[]
children
=
[]
for
child
in
node
.
get_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