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
62758223
Unverified
Commit
62758223
authored
Apr 26, 2018
by
老广
Committed by
GitHub
Apr 26, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1268 from jumpserver/bufix_for_perm_tree
[Bugfix] 解决上次引入的bug
parents
59eb1f8e
5103dab7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
node.py
apps/assets/api/node.py
+4
-4
asset.py
apps/assets/serializers/asset.py
+1
-2
No files found.
apps/assets/api/node.py
View file @
62758223
...
...
@@ -108,18 +108,18 @@ class NodeChildrenApi(mixins.ListModelMixin, generics.CreateAPIView):
return
node
def
get_queryset
(
self
):
queryset
=
set
()
queryset
=
[]
query_all
=
self
.
request
.
query_params
.
get
(
"all"
)
query_assets
=
self
.
request
.
query_params
.
get
(
'assets'
)
node
=
self
.
get_object
()
if
node
==
Node
.
root
():
queryset
.
a
d
d
(
node
)
queryset
.
a
ppen
d
(
node
)
if
query_all
:
children
=
node
.
get_all_children
()
else
:
children
=
node
.
get_children
()
queryset
.
update
(
se
t
(
children
))
queryset
.
extend
(
lis
t
(
children
))
if
query_assets
:
assets
=
node
.
get_assets
()
for
asset
in
assets
:
...
...
@@ -128,7 +128,7 @@ class NodeChildrenApi(mixins.ListModelMixin, generics.CreateAPIView):
node_fake
.
parent
=
node
node_fake
.
value
=
asset
.
hostname
node_fake
.
is_node
=
False
queryset
.
a
d
d
(
node_fake
)
queryset
.
a
ppen
d
(
node_fake
)
queryset
=
sorted
(
queryset
,
key
=
lambda
x
:
x
.
is_node
,
reverse
=
True
)
return
queryset
...
...
apps/assets/serializers/asset.py
View file @
62758223
...
...
@@ -18,8 +18,7 @@ class NodeTMPSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
Node
fields
=
[
'id'
,
'key'
,
'value'
,
'parent'
,
'assets_amount'
,
'is_asset'
]
fields
=
[
'id'
,
'key'
,
'value'
,
'parent'
,
'assets_amount'
,
'is_node'
]
list_serializer_class
=
BulkListSerializer
@staticmethod
...
...
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