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
6ba78e2c
Unverified
Commit
6ba78e2c
authored
May 30, 2019
by
BaiJiangJie
Committed by
GitHub
May 30, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2756 from jumpserver/dev
Dev
parents
d46f5858
63a06b5d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
asset.py
apps/assets/api/asset.py
+1
-1
mixins.py
apps/orgs/mixins.py
+3
-1
No files found.
apps/assets/api/asset.py
View file @
6ba78e2c
...
...
@@ -51,7 +51,7 @@ class AssetViewSet(IDInCacheFilterMixin, LabelFilter, BulkModelViewSet):
def
set_assets_node
(
self
,
assets
):
if
not
isinstance
(
assets
,
list
):
assets
=
[
assets
]
node
=
Node
.
objects
.
get
(
value
=
'Default'
)
node
=
Node
.
root
(
)
node_id
=
self
.
request
.
query_params
.
get
(
'node_id'
)
if
node_id
:
node
=
get_object_or_none
(
Node
,
pk
=
node_id
)
...
...
apps/orgs/mixins.py
View file @
6ba78e2c
...
...
@@ -212,5 +212,7 @@ class OrgResourceSerializerMixin(serializers.Serializer):
"""
通过API批量操作资源时, 自动给每个资源添加所需属性org_id的值为current_org_id
(同时为serializer.is_valid()对Model的unique_together校验做准备)
由于HiddenField字段不可读,API获取资产信息时获取不到org_id,
但是coco需要资产的org_id字段,所以修改为CharField类型
"""
org_id
=
serializers
.
Hidden
Field
(
default
=
get_current_org_id
)
org_id
=
serializers
.
Char
Field
(
default
=
get_current_org_id
)
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