Merge pull request #1600 from jumpserver/bai_org

[Bugfix] 修复org下普通用户打开web终端看不到已被授权的资产和节点bug
pull/1602/head
老广 2018-07-26 23:08:55 -05:00 committed by GitHub
commit 4ff7a1f066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()