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
e7d600ee
Commit
e7d600ee
authored
Jul 02, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bugfix' of github.com:jumpserver/jumpserver into bugfix
parents
b9f82fd0
186c22de
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
asset_permission.py
apps/perms/models/asset_permission.py
+9
-1
asset_permission.py
apps/perms/views/asset_permission.py
+1
-1
No files found.
apps/perms/models/asset_permission.py
View file @
e7d600ee
...
...
@@ -4,7 +4,7 @@ from functools import reduce
from
django.db
import
models
from
django.utils.translation
import
ugettext_lazy
as
_
from
common.utils
import
date_expired_default
from
common.utils
import
date_expired_default
,
set_or_append_attr_bulk
from
orgs.mixins
import
OrgModelMixin
from
.base
import
BasePermission
...
...
@@ -79,6 +79,14 @@ class AssetPermission(BasePermission):
def
get_queryset_with_prefetch
(
cls
):
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
):
id
=
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
primary_key
=
True
)
...
...
apps/perms/views/asset_permission.py
View file @
e7d600ee
...
...
@@ -155,7 +155,7 @@ class AssetPermissionAssetView(PermissionsMixin,
permission_classes
=
[
IsOrgAdmin
]
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
)
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