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
7e16ce41
Unverified
Commit
7e16ce41
authored
Jun 20, 2019
by
BaiJiangJie
Committed by
GitHub
Jun 20, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2820 from jumpserver/dev_perms
[Update] 修改资产授权序列类返回资产protocols的协议格式/, 同时添加protocol和port字段
parents
895dfe47
152c5936
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
17 deletions
+8
-17
vault.py
apps/assets/backends/vault.py
+1
-9
asset.py
apps/assets/serializers/asset.py
+7
-8
No files found.
apps/assets/backends/vault.py
View file @
7e16ce41
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
#
from
.
.
base
import
BaseBackend
from
.base
import
BaseBackend
class
VaultBackend
(
BaseBackend
):
class
VaultBackend
(
BaseBackend
):
@classmethod
def
get
(
cls
,
username
,
asset
):
pass
@classmethod
@classmethod
def
filter
(
cls
,
username
=
None
,
asset
=
None
,
latest
=
True
):
def
filter
(
cls
,
username
=
None
,
asset
=
None
,
latest
=
True
):
pass
pass
@classmethod
def
create
(
cls
,
**
kwargs
):
pass
apps/assets/serializers/asset.py
View file @
7e16ce41
...
@@ -27,8 +27,6 @@ class ProtocolsRelatedField(serializers.RelatedField):
...
@@ -27,8 +27,6 @@ class ProtocolsRelatedField(serializers.RelatedField):
return
str
(
value
)
return
str
(
value
)
def
to_internal_value
(
self
,
data
):
def
to_internal_value
(
self
,
data
):
print
(
data
)
print
(
type
(
data
))
if
isinstance
(
data
,
dict
):
if
isinstance
(
data
,
dict
):
return
data
return
data
if
'/'
not
in
data
:
if
'/'
not
in
data
:
...
@@ -152,7 +150,9 @@ class AssetGrantedSerializer(serializers.ModelSerializer):
...
@@ -152,7 +150,9 @@ class AssetGrantedSerializer(serializers.ModelSerializer):
"""
"""
被授权资产的数据结构
被授权资产的数据结构
"""
"""
protocols
=
ProtocolSerializer
(
many
=
True
)
protocols
=
ProtocolsRelatedField
(
many
=
True
,
queryset
=
Protocol
.
objects
.
all
(),
label
=
_
(
"Protocols"
)
)
system_users_granted
=
AssetSystemUserSerializer
(
many
=
True
,
read_only
=
True
)
system_users_granted
=
AssetSystemUserSerializer
(
many
=
True
,
read_only
=
True
)
system_users_join
=
serializers
.
SerializerMethodField
()
system_users_join
=
serializers
.
SerializerMethodField
()
# nodes = NodeTMPSerializer(many=True, read_only=True)
# nodes = NodeTMPSerializer(many=True, read_only=True)
...
@@ -160,9 +160,9 @@ class AssetGrantedSerializer(serializers.ModelSerializer):
...
@@ -160,9 +160,9 @@ class AssetGrantedSerializer(serializers.ModelSerializer):
class
Meta
:
class
Meta
:
model
=
Asset
model
=
Asset
fields
=
(
fields
=
(
"id"
,
"hostname"
,
"ip"
,
"protocol
s"
,
"system_users_granted
"
,
"id"
,
"hostname"
,
"ip"
,
"protocol
"
,
"port"
,
"protocols
"
,
"
is_active"
,
"system_users_join"
,
"os"
,
'domain'
,
"
system_users_granted"
,
"is_active"
,
"system_users_join"
,
"os"
,
"platform"
,
"comment"
,
"org_id"
,
"org_name"
,
'domain'
,
"platform"
,
"comment"
,
"org_id"
,
"org_name"
,
)
)
@staticmethod
@staticmethod
...
@@ -187,8 +187,7 @@ class AssetGrantedSerializer(serializers.ModelSerializer):
...
@@ -187,8 +187,7 @@ class AssetGrantedSerializer(serializers.ModelSerializer):
class
AssetSimpleSerializer
(
serializers
.
ModelSerializer
):
class
AssetSimpleSerializer
(
serializers
.
ModelSerializer
):
protocols
=
ProtocolSerializer
(
many
=
True
)
class
Meta
:
class
Meta
:
model
=
Asset
model
=
Asset
fields
=
[
'id'
,
'hostname'
,
'ip'
,
'
protocols'
,
'
connectivity'
,
'port'
]
fields
=
[
'id'
,
'hostname'
,
'ip'
,
'connectivity'
,
'port'
]
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