From 30c4fc951429b8bdcecd43f4e6c5822cf338d225 Mon Sep 17 00:00:00 2001 From: ibuler Date: Sun, 22 Oct 2017 17:53:46 +0800 Subject: [PATCH] App user get user perms --- apps/perms/api.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/perms/api.py b/apps/perms/api.py index 8f6df1469..a2f014793 100644 --- a/apps/perms/api.py +++ b/apps/perms/api.py @@ -5,7 +5,7 @@ from django.shortcuts import get_object_or_404 from rest_framework.views import APIView, Response from rest_framework.generics import ListAPIView, get_object_or_404 from rest_framework import viewsets -from users.permissions import IsValidUser, IsSuperUser, IsAppUser +from users.permissions import IsValidUser, IsSuperUser, IsAppUser, IsSuperUserOrAppUser from common.utils import get_object_or_none from .utils import get_user_granted_assets, get_user_granted_asset_groups, \ get_user_asset_permissions, get_user_group_asset_permissions, \ @@ -118,7 +118,7 @@ class RevokeUserGroupAssetPermission(APIView): class UserGrantedAssetsApi(ListAPIView): - permission_classes = (IsSuperUser,) + permission_classes = (IsSuperUserOrAppUser,) serializer_class = AssetGrantedSerializer def get_queryset(self): @@ -134,7 +134,7 @@ class UserGrantedAssetsApi(ListAPIView): class UserGrantedAssetGroupsApi(ListAPIView): - permission_classes = (IsSuperUser,) + permission_classes = (IsSuperUserOrAppUser,) serializer_class = AssetGroupSerializer def get_queryset(self): @@ -166,6 +166,7 @@ class MyGrantedAssetsApi(ListAPIView): return queryset + class MyGrantedAssetsGroupsApi(APIView): """授权给用户的资产组列表, 非直接通过授权规则授权的资产组列表, 而是授权资产的所有 资产组之和"""