refactor: 重构用户授权资产查询工具(重构中..) (#9225)

* refactor: 重构用户授权资产查询工具(重构中..)

* perf: 修改 get_perm_nodes_assets 名称

* refactor: 优化用户授权节点查询工具; 删除UnionQuerySet工具

Co-authored-by: Bai <baijiangjie@gmail.com>
This commit is contained in:
fit2bot
2022-12-21 17:36:44 +08:00
committed by GitHub
parent 510ca9a5b8
commit 34cc3b233d
11 changed files with 269 additions and 415 deletions

View File

@@ -9,7 +9,7 @@ from orgs.mixins.api import OrgBulkModelViewSet
from orgs.utils import current_org
from perms import serializers
from perms import models
from perms.utils.user_permission import UserGrantedAssetsQueryUtils
from perms.utils import AssetPermissionPermAssetUtil
from assets.serializers import AccountSerializer
__all__ = [
@@ -95,8 +95,7 @@ class AssetPermissionAllAssetListApi(generics.ListAPIView):
def get_queryset(self):
pk = self.kwargs.get("pk")
query_utils = UserGrantedAssetsQueryUtils(None, asset_perm_ids=[pk])
assets = query_utils.get_all_granted_assets()
assets = AssetPermissionPermAssetUtil(perm_ids=[pk]).get_all_assets()
return assets