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
4d385697
Commit
4d385697
authored
Jul 01, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改一些bug
parent
034fee0f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
28 deletions
+7
-28
node.py
apps/assets/api/node.py
+3
-1
asset.py
apps/assets/serializers/asset.py
+0
-24
asset_permission.py
apps/perms/api/asset_permission.py
+3
-1
asset_permission.py
apps/perms/forms/asset_permission.py
+0
-1
asset_permission_create_update.html
...perms/templates/perms/asset_permission_create_update.html
+1
-1
No files found.
apps/assets/api/node.py
View file @
4d385697
...
@@ -130,7 +130,9 @@ class NodeChildrenAsTreeApi(generics.ListAPIView):
...
@@ -130,7 +130,9 @@ class NodeChildrenAsTreeApi(generics.ListAPIView):
include_assets
=
self
.
request
.
query_params
.
get
(
'assets'
,
'0'
)
==
'1'
include_assets
=
self
.
request
.
query_params
.
get
(
'assets'
,
'0'
)
==
'1'
if
not
include_assets
:
if
not
include_assets
:
return
queryset
return
queryset
assets
=
self
.
node
.
get_assets
()
assets
=
self
.
node
.
get_assets
()
.
prefetch_related
(
"protocols"
)
.
only
(
"id"
,
"hostname"
,
"ip"
,
'platform'
,
"os"
,
"org_id"
,
)
for
asset
in
assets
:
for
asset
in
assets
:
queryset
.
append
(
asset
.
as_tree_node
(
self
.
node
))
queryset
.
append
(
asset
.
as_tree_node
(
self
.
node
))
return
queryset
return
queryset
...
...
apps/assets/serializers/asset.py
View file @
4d385697
...
@@ -138,30 +138,6 @@ class AssetSerializer(BulkOrgResourceModelSerializer):
...
@@ -138,30 +138,6 @@ class AssetSerializer(BulkOrgResourceModelSerializer):
return
instance
return
instance
# class AssetAsNodeSerializer(serializers.ModelSerializer):
# protocols = ProtocolSerializer(many=True)
#
# class Meta:
# model = Asset
# fields = ['id', 'hostname', 'ip', 'platform', 'protocols']
# class MyAssetGrantedSerializer(AssetGrantedSerializer):
# """
# 普通用户获取授权的资产定义的数据结构
# """
# protocols = ProtocolSerializer(many=True)
#
# class Meta:
# model = Asset
# fields = (
# "id", "hostname", "system_users_granted",
# "is_active", "system_users_join", "org_name",
# "os", "platform", "comment", "org_id", "protocols"
# )
class
AssetSimpleSerializer
(
serializers
.
ModelSerializer
):
class
AssetSimpleSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
class
Meta
:
...
...
apps/perms/api/asset_permission.py
View file @
4d385697
...
@@ -155,7 +155,9 @@ class AssetPermissionViewSet(viewsets.ModelViewSet):
...
@@ -155,7 +155,9 @@ class AssetPermissionViewSet(viewsets.ModelViewSet):
return
queryset
return
queryset
def
get_queryset
(
self
):
def
get_queryset
(
self
):
return
self
.
queryset
.
all
()
return
self
.
queryset
.
all
()
.
prefetch_related
(
"nodes"
,
"assets"
,
"users"
,
"user_groups"
,
"system_users"
)
class
AssetPermissionRemoveUserApi
(
RetrieveUpdateAPIView
):
class
AssetPermissionRemoveUserApi
(
RetrieveUpdateAPIView
):
...
...
apps/perms/forms/asset_permission.py
View file @
4d385697
# ~*~ coding: utf-8 ~*~
# ~*~ coding: utf-8 ~*~
from
__future__
import
absolute_import
,
unicode_literals
from
__future__
import
absolute_import
,
unicode_literals
from
functools
import
reduce
from
django
import
forms
from
django
import
forms
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
...
...
apps/perms/templates/perms/asset_permission_create_update.html
View file @
4d385697
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
{% bootstrap_field form.system_users layout="horizontal" %}
{% bootstrap_field form.system_users layout="horizontal" %}
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<h3>
{% trans 'Action' %}
</h3>
<h3>
{% trans 'Action' %}
</h3>
{% bootstrap_field form.action layout="horizontal" %}
{% bootstrap_field form.action
s
layout="horizontal" %}
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<h3>
{% trans 'Other' %}
</h3>
<h3>
{% trans 'Other' %}
</h3>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
...
...
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