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
c0d51e22
Unverified
Commit
c0d51e22
authored
Nov 14, 2018
by
老广
Committed by
GitHub
Nov 14, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2035 from jumpserver/origin_dev
Origin dev
parents
69ab3e35
87abe63a
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 @
c0d51e22
...
...
@@ -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
]
else
:
node
=
first_node
queryset
=
[]
if
node
==
first_node
:
elif
len
(
root_nodes
)
==
1
:
node
=
root_nodes
[
0
]
node
.
assets_amount
=
len
(
nodes_granted
[
node
])
queryset
.
append
(
node
)
else
:
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