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
003601bb
Commit
003601bb
authored
Jul 02, 2019
by
BaiJiangJie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 解决进入授权详情页的资产管理页面bug
parent
98260b5b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
asset_permission.py
apps/perms/models/asset_permission.py
+8
-0
asset_permission.py
apps/perms/views/asset_permission.py
+1
-1
No files found.
apps/perms/models/asset_permission.py
View file @
003601bb
...
@@ -96,6 +96,14 @@ class AssetPermission(BasePermission):
...
@@ -96,6 +96,14 @@ class AssetPermission(BasePermission):
def
get_queryset_with_prefetch
(
cls
):
def
get_queryset_with_prefetch
(
cls
):
return
cls
.
objects
.
all
()
.
valid
()
.
prefetch_related
(
'nodes'
,
'assets'
,
'system_users'
)
return
cls
.
objects
.
all
()
.
valid
()
.
prefetch_related
(
'nodes'
,
'assets'
,
'system_users'
)
def
get_all_assets
(
self
):
assets
=
set
(
self
.
assets
.
all
())
for
node
in
self
.
nodes
.
all
():
_assets
=
node
.
get_all_assets
()
set_or_append_attr_bulk
(
_assets
,
'inherit'
,
node
.
value
)
assets
.
update
(
set
(
_assets
))
return
assets
class
NodePermission
(
OrgModelMixin
):
class
NodePermission
(
OrgModelMixin
):
id
=
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
primary_key
=
True
)
id
=
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
primary_key
=
True
)
...
...
apps/perms/views/asset_permission.py
View file @
003601bb
...
@@ -156,7 +156,7 @@ class AssetPermissionAssetView(PermissionsMixin,
...
@@ -156,7 +156,7 @@ class AssetPermissionAssetView(PermissionsMixin,
permission_classes
=
[
IsOrgAdmin
]
permission_classes
=
[
IsOrgAdmin
]
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
self
.
object
=
self
.
get_object
(
queryset
=
AssetPermission
.
objects
.
all
())
self
.
object
=
self
.
get_object
(
queryset
=
AssetPermission
.
objects
.
all
())
return
super
()
.
get
(
request
,
*
args
,
**
kwargs
)
return
super
()
.
get
(
request
,
*
args
,
**
kwargs
)
def
get_queryset
(
self
):
def
get_queryset
(
self
):
...
...
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