Merge pull request #1204 from jumpserver/bugfix_user_assets

[Bugfix] 修复用户看不到我的资产的bug
pull/1213/head
老广 2018-04-16 17:04:29 +08:00 committed by GitHub
commit 45b13abed3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -98,6 +98,11 @@ class UserGrantedNodesApi(ListAPIView):
nodes = AssetPermissionUtil.get_user_nodes_with_assets(user)
return nodes.keys()
def get_permissions(self):
if self.kwargs.get('pk') is None:
self.permission_classes = (IsValidUser,)
return super().get_permissions()
class UserGrantedNodesWithAssetsApi(ListAPIView):
permission_classes = (IsSuperUserOrAppUser,)