MCPcopy Create free account
hub / github.com/binkuolo/fastapi / access_tree

Function access_tree

api/endpoints/access.py:80–95  ·  view source on GitHub ↗

遍历权限树 :param data: rule[] :param pid: 父ID :return: list

(data, pid)

Source from the content-addressed store, hash-verified

78
79
80def access_tree(data, pid):
81 """
82 遍历权限树
83 :param data: rule[]
84 :param pid: 父ID
85 :return: list
86 """
87 result = []
88 for item in data:
89 if pid == item["parent_id"]:
90 temp = access_tree(data, item["key"])
91 if len(temp) > 0:
92 # item["key"] = str(item["key"])
93 item["children"] = temp
94 result.append(item)
95 return result

Callers 1

get_all_accessFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected