[Bugfix] 修复org下普通用户打开web终端看不到已被授权的资产和节点bug

pull/1600/head
BaiJiangJie 2018-07-27 10:42:32 +08:00
parent a48fb9de8d
commit 45a354f848
1 changed files with 3 additions and 0 deletions

View File

@ -14,6 +14,8 @@ from .models import AssetPermission
from .hands import AssetGrantedSerializer, User, UserGroup, Asset, Node, \
NodeGrantedSerializer, SystemUser, NodeSerializer
from . import serializers
from orgs.utils import set_current_org
from orgs.models import Organization
class AssetPermissionViewSet(viewsets.ModelViewSet):
@ -128,6 +130,7 @@ 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()