fix: 修复异步加载luna资产授权树时根节点下资产没有返回的问题

pull/9239/head
Bai 2022-12-22 19:17:52 +08:00
parent 4aed287efc
commit 3443b06a28
2 changed files with 7 additions and 0 deletions

View File

@ -102,6 +102,12 @@ class UserPermedNodeChildrenWithAssetsAsTreeApi(BaseUserNodeWithAssetAsTreeApi):
if not node_key:
nodes = query_node_util.get_top_level_nodes()
assets = Asset.objects.none()
# 获取根节点下的资产
for node in nodes:
if not node.key.isdigit():
continue
assets = query_asset_util.get_node_assets(key=node.key)
break
elif node_key == PermNode.UNGROUPED_NODE_KEY:
nodes = PermNode.objects.none()
assets = query_asset_util.get_ungroup_assets()

View File

@ -150,6 +150,7 @@ class UserPermNodeUtil:
def get_top_level_nodes(self):
nodes = self.get_special_nodes()
# 获取组织下的根节点
real_nodes = self._get_indirect_perm_node_children(key='')
nodes.extend(real_nodes)
if len(real_nodes) == 1: