fix: 用户管理-用户-授权的资产-收藏夹下拉菜单报404bug修复

pull/6555/head
feng626 2021-07-28 14:21:53 +08:00
parent 905d0d5131
commit d0680c3753
1 changed files with 13 additions and 12 deletions

View File

@ -203,7 +203,8 @@ class UserGrantedTreeRefreshController:
logger.info(f'Rebuild user tree: user={self.user} org={current_org}')
utils = UserGrantedTreeBuildUtils(user)
utils.rebuild_user_granted_tree()
logger.info(f'Rebuild user tree ok: cost={time.time() - t_start} user={self.user} org={current_org}')
logger.info(
f'Rebuild user tree ok: cost={time.time() - t_start} user={self.user} org={current_org}')
class UserGrantedUtilsBase:
@ -547,14 +548,14 @@ class UserGrantedNodesQueryUtils(UserGrantedUtilsBase):
if not key:
return self.get_top_level_nodes()
nodes = PermNode.objects.none()
if key != PermNode.FAVORITE_NODE_KEY:
node = PermNode.objects.get(key=key)
granted_status = node.get_granted_status(self.user)
if granted_status == NodeFrom.granted:
nodes = PermNode.objects.filter(parent_key=key)
elif granted_status in (NodeFrom.asset, NodeFrom.child):
nodes = self.get_indirect_granted_node_children(key)
else:
nodes = PermNode.objects.none()
nodes = self.sort(nodes)
return nodes