mirror of https://github.com/jumpserver/jumpserver
perf: 代码优化
parent
d0680c3753
commit
da588ce0ae
|
@ -549,13 +549,15 @@ class UserGrantedNodesQueryUtils(UserGrantedUtilsBase):
|
||||||
return self.get_top_level_nodes()
|
return self.get_top_level_nodes()
|
||||||
|
|
||||||
nodes = PermNode.objects.none()
|
nodes = PermNode.objects.none()
|
||||||
if key != PermNode.FAVORITE_NODE_KEY:
|
if key == PermNode.FAVORITE_NODE_KEY:
|
||||||
node = PermNode.objects.get(key=key)
|
return nodes
|
||||||
granted_status = node.get_granted_status(self.user)
|
|
||||||
if granted_status == NodeFrom.granted:
|
node = PermNode.objects.get(key=key)
|
||||||
nodes = PermNode.objects.filter(parent_key=key)
|
granted_status = node.get_granted_status(self.user)
|
||||||
elif granted_status in (NodeFrom.asset, NodeFrom.child):
|
if granted_status == NodeFrom.granted:
|
||||||
nodes = self.get_indirect_granted_node_children(key)
|
nodes = PermNode.objects.filter(parent_key=key)
|
||||||
|
elif granted_status in (NodeFrom.asset, NodeFrom.child):
|
||||||
|
nodes = self.get_indirect_granted_node_children(key)
|
||||||
nodes = self.sort(nodes)
|
nodes = self.sort(nodes)
|
||||||
return nodes
|
return nodes
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue