mirror of https://github.com/jumpserver/jumpserver
[Update] Merge with org
parent
9166a26f80
commit
d3dca5d077
|
@ -17,7 +17,8 @@ logger = get_logger(__file__)
|
|||
tl = local()
|
||||
|
||||
__all__ = [
|
||||
'OrgManager', 'OrgViewGenericMixin', 'OrgModelMixin', 'OrgModelForm'
|
||||
'OrgManager', 'OrgViewGenericMixin', 'OrgModelMixin', 'OrgModelForm',
|
||||
'RootOrgViewMixin',
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue