From 017682b383f438d5ba4aaef75f9f7f31951773b3 Mon Sep 17 00:00:00 2001 From: Aaron3S Date: Mon, 27 Mar 2023 14:37:04 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=A2=9E=E5=8A=A0=E6=88=91=E7=9A=84?= =?UTF-8?q?=E8=B5=84=E4=BA=A7=E9=80=9A=E8=BF=87=20node=5Fid=20=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E6=88=91=E7=9A=84=E8=B5=84=E4=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/perms/api/user_permission/assets.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/perms/api/user_permission/assets.py b/apps/perms/api/user_permission/assets.py index f94854164..1ec27803f 100644 --- a/apps/perms/api/user_permission/assets.py +++ b/apps/perms/api/user_permission/assets.py @@ -4,7 +4,7 @@ from rest_framework.generics import ListAPIView from assets.api.asset.asset import AssetFilterSet from assets.models import Asset, Node -from common.utils import get_logger, lazyproperty +from common.utils import get_logger, lazyproperty, is_uuid from perms import serializers from perms.pagination import AllPermedAssetPagination from perms.pagination import NodePermedAssetPagination @@ -58,7 +58,12 @@ class UserAllPermedAssetsApi(BaseUserPermedAssetsApi): pagination_class = AllPermedAssetPagination def get_assets(self): - return self.query_asset_util.get_all_assets() + node_id = self.request.query_params.get('node_id') + if is_uuid(node_id): + __, assets = self.query_asset_util.get_node_all_assets(node_id) + else: + assets = self.query_asset_util.get_all_assets() + return assets class UserDirectPermedAssetsApi(BaseUserPermedAssetsApi):