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
d3dca5d0
Commit
d3dca5d0
authored
Jul 27, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] Merge with org
parent
9166a26f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
7 deletions
+5
-7
mixins.py
apps/orgs/mixins.py
+2
-1
api.py
apps/perms/api.py
+3
-6
No files found.
apps/orgs/mixins.py
View file @
d3dca5d0
...
...
@@ -17,7 +17,8 @@ logger = get_logger(__file__)
tl
=
local
()
__all__
=
[
'OrgManager'
,
'OrgViewGenericMixin'
,
'OrgModelMixin'
,
'OrgModelForm'
'OrgManager'
,
'OrgViewGenericMixin'
,
'OrgModelMixin'
,
'OrgModelForm'
,
'RootOrgViewMixin'
,
]
...
...
apps/perms/api.py
View file @
d3dca5d0
...
...
@@ -87,7 +87,7 @@ class UserGrantedAssetsApi(ListAPIView):
return
super
()
.
get_permissions
()
class
UserGrantedNodesApi
(
ListAPIView
):
class
UserGrantedNodesApi
(
RootOrgViewMixin
,
ListAPIView
):
permission_classes
=
(
IsOrgAdmin
,)
serializer_class
=
NodeSerializer
...
...
@@ -102,13 +102,12 @@ class UserGrantedNodesApi(ListAPIView):
return
nodes
.
keys
()
def
get_permissions
(
self
):
set_current_org
(
Organization
.
root
())
if
self
.
kwargs
.
get
(
'pk'
)
is
None
:
self
.
permission_classes
=
(
IsValidUser
,)
return
super
()
.
get_permissions
()
class
UserGrantedNodesWithAssetsApi
(
ListAPIView
):
class
UserGrantedNodesWithAssetsApi
(
RootOrgViewMixin
,
ListAPIView
):
permission_classes
=
(
IsOrgAdminOrAppUser
,)
serializer_class
=
NodeGrantedSerializer
...
...
@@ -132,13 +131,12 @@ class UserGrantedNodesWithAssetsApi(ListAPIView):
return
queryset
def
get_permissions
(
self
):
set_current_org
(
Organization
.
root
())
if
self
.
kwargs
.
get
(
'pk'
)
is
None
:
self
.
permission_classes
=
(
IsValidUser
,)
return
super
()
.
get_permissions
()
class
UserGrantedNodeAssetsApi
(
ListAPIView
):
class
UserGrantedNodeAssetsApi
(
RootOrgViewMixin
,
ListAPIView
):
permission_classes
=
(
IsOrgAdminOrAppUser
,)
serializer_class
=
AssetGrantedSerializer
...
...
@@ -159,7 +157,6 @@ class UserGrantedNodeAssetsApi(ListAPIView):
return
assets
def
get_permissions
(
self
):
set_current_org
(
Organization
.
root
())
if
self
.
kwargs
.
get
(
'pk'
)
is
None
:
self
.
permission_classes
=
(
IsValidUser
,)
return
super
()
.
get_permissions
()
...
...
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