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
c1db3371
Commit
c1db3371
authored
May 16, 2018
by
BaiJiangJie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修复资产授权树root节点bug
parent
e66cfc2e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
node.py
apps/assets/api/node.py
+3
-4
No files found.
apps/assets/api/node.py
View file @
c1db3371
...
@@ -123,7 +123,7 @@ class NodeChildrenApi(mixins.ListModelMixin, generics.CreateAPIView):
...
@@ -123,7 +123,7 @@ class NodeChildrenApi(mixins.ListModelMixin, generics.CreateAPIView):
def
get_object
(
self
):
def
get_object
(
self
):
pk
=
self
.
kwargs
.
get
(
'pk'
)
or
self
.
request
.
query_params
.
get
(
'id'
)
pk
=
self
.
kwargs
.
get
(
'pk'
)
or
self
.
request
.
query_params
.
get
(
'id'
)
if
not
pk
:
if
not
pk
:
node
=
No
de
.
root
()
node
=
No
ne
else
:
else
:
node
=
get_object_or_404
(
Node
,
pk
=
pk
)
node
=
get_object_or_404
(
Node
,
pk
=
pk
)
return
node
return
node
...
@@ -133,7 +133,8 @@ class NodeChildrenApi(mixins.ListModelMixin, generics.CreateAPIView):
...
@@ -133,7 +133,8 @@ class NodeChildrenApi(mixins.ListModelMixin, generics.CreateAPIView):
query_all
=
self
.
request
.
query_params
.
get
(
"all"
)
query_all
=
self
.
request
.
query_params
.
get
(
"all"
)
query_assets
=
self
.
request
.
query_params
.
get
(
'assets'
)
query_assets
=
self
.
request
.
query_params
.
get
(
'assets'
)
node
=
self
.
get_object
()
node
=
self
.
get_object
()
if
node
==
Node
.
root
():
if
node
is
None
:
node
=
Node
.
root
()
queryset
.
append
(
node
)
queryset
.
append
(
node
)
if
query_all
:
if
query_all
:
children
=
node
.
get_all_children
()
children
=
node
.
get_all_children
()
...
@@ -184,8 +185,6 @@ class NodeAddChildrenApi(generics.UpdateAPIView):
...
@@ -184,8 +185,6 @@ class NodeAddChildrenApi(generics.UpdateAPIView):
for
node
in
children
:
for
node
in
children
:
if
not
node
:
if
not
node
:
continue
continue
# node.parent = instance
# node.save()
node
.
set_parent
(
instance
)
node
.
set_parent
(
instance
)
return
Response
(
"OK"
)
return
Response
(
"OK"
)
...
...
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