A method and system for managing menu permissions using routing tree wildcards

The method of managing menu permissions by using wildcards in the routing tree solves the problem of duplicate configuration caused by URL design not conforming to the RESTful style and interface version changes in existing technologies, and achieves efficient and flexible menu permission management.

CN119248147BActive Publication Date: 2025-11-14福建天晴在线互动科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411306623.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2025-11-14
Estimated Expiration
2044-09-19

AI Technical Summary

Technical Problem

Existing technologies struggle to support RESTful URL design when managing menu permissions, and require repeated updates to backend menu configuration and permission allocation when the interface version changes, resulting in a large workload and non-compliance with industry standards.

Method used

The method of managing menu permissions using route tree wildcards is adopted. By defining RouteNode and TreeMeta structures, the menu path is organized in a tree structure, and wildcards are supported to manage menu number relationships, enabling fast menu routing and search.

Benefits of technology

The tree structure efficiently manages the relationship between menu paths and associated menu numbers, supports flexible menu address rules, reduces repetitive configuration work, and improves the efficiency and flexibility of permission management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248147B_ABST
    Figure CN119248147B_ABST
Patent Text Reader

Abstract

A method and system for managing menu permissions using route tree wildcards includes defining a RouteNode structure to represent a route tree node, containing the following fields: Path for the current node's path, Children is a dictionary of child nodes, and Data is an array of associated menu numbers. A TreeMeta structure is also defined, containing a pointer Root to the root node. All menu data is traversed, and each menu path (Url) is split into an array (array) using ' / '. Each array element is iterated through, starting from the root node Root, to traverse and create nodes. When a user accesses a menu, the system retrieves the menu path (Url), splits it into an array (array) using ' / ', and recursively searches layer by layer from the root node of the global route tree to find the menu number in the last element of the path. The system iterates through the set of menu numbers and reads a permission table to determine if the user has permission for the menu number. This invention supports wildcards to manage the relationship between menu paths and associated menu numbers, supporting fast menu routing and lookup.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer communication technology, and in particular to a method-level system for managing menu permissions using routing tree wildcards. Background Technology

[0002] In the backend system, each function menu corresponds to a specific URL address, and users can only access the menu if they are authorized. For example, suppose there is a RESTful order deletion interface with the address api.xxx.com / order / {orderid}, using the HTTP DELETE request method. This means that {orderid} in the URL changes dynamically with each access, making it impractical to configure the deletion address for all orders in the menu. The traditional solution is to avoid RESTful URL design and instead use routing methods such as api.xxx.com / order / del?id={orderid}. However, this method does not conform to industry-standard RESTful interface design principles. Furthermore, if the interface needs to include a version number, such as api.xxx.com / {version} / order, then each time a new interface version is added, the backend menu configuration and permission allocation need to be updated, resulting in repetitive workload. Summary of the Invention

[0003] To overcome the above problems, the purpose of this invention is to provide a method for managing menu permissions using routing tree wildcards, which can support wildcards to manage the relationship between menu paths and associated menu numbers, and support fast menu routing and searching.

[0004] This invention is implemented using the following scheme: a method for managing menu permissions using routing tree wildcards, the method comprising the following steps:

[0005] Step S1: Define a RouteNode structure to represent a route tree node, containing the following fields: Path is the path of the current node, Children is a dictionary collection of child nodes, and Data is an array of associated menu numbers. Define a TreeMeta structure containing a pointer Root to the root node, which is used to store global route tree data in memory.

[0006] Step S2: Traverse all menu data in the database, split each menu path URL into an array array according to ' / ', loop through each array element, and traverse and create nodes starting from the root node Root;

[0007] Step S3: When a user accesses the menu, the system obtains the menu path URL, splits the URL into an array by ' / ', and recursively searches layer by layer from the root node of the global routing tree, matching the path of the routing tree node with the value of the path array element to find the menu number in the last element of the path.

[0008] Step S4: The system cycles through the set of menu numbers, reads the permission table to determine if the user has permission for any of the menu numbers. If the user has permission for any menu number, the process is successful; otherwise, it returns failure.

[0009] Furthermore, the step S2 of looping through each array element, starting from the root node Root, and creating nodes is further defined as follows: if a node does not exist, a new node is created; if a node already exists, the process continues downwards until the last part of the path is processed, and the menu number is appended to the Data array of the last route node.

[0010] Furthermore, in step S3, finding the menu number in the last element of the path is further defined as follows: matching the path of the routing tree node and the value of the path array element. If the current node's Children set contains a wildcard '*' or a child node of an element in the current menu interface address array, the search continues downward until the last element of the path is found, and the Data array of that node contains the menu number, indicating that the corresponding menu number set has been successfully found; if there is no matching address and no child node of the wildcard '*', it means that no matching path was found, and failure is returned.

[0011] A system for managing menu permissions using routing tree wildcards, the system comprising a definition module, a node creation module, a menu number lookup module, and a permission verification module;

[0012] The definition module defines a RouteNode structure to represent a route tree node, containing the following fields: Path for the current node's path, Children for the dictionary of child nodes, and Data for the array of associated menu numbers. It also defines a TreeMeta structure containing a pointer Root to the root node, used to store global route tree data in memory.

[0013] The node creation module iterates through all menu data in the database, splits each menu path URL into an array according to ' / ', loops through each array element, and iterates and creates nodes starting from the root node Root.

[0014] The menu number lookup module works as follows: When a user accesses a menu, the system obtains the menu path URL, splits the URL into an array by ' / ', and recursively searches layer by layer from the root node of the global routing tree, matching the path of the routing tree node with the value of the path array element to find the menu number in the last element of the path.

[0015] The permission verification module: The system cycles through the set of menu numbers, reads the permission table to determine whether the user has permission for any menu number. If the user has permission for any menu number, the process is successful; otherwise, it returns failure.

[0016] Furthermore, the node creation module's loop through each array element, starting from the root node, and node creation is further defined as follows: if a node does not exist, a new node is created; if it already exists, the process continues downwards until the last part of the path is processed, and the menu number is appended to the Data array of the last route node.

[0017] Furthermore, the menu number lookup module finds the menu number in the last element of the path by matching the path of the route tree node and the value of the path array element. If the current node's Children set contains a wildcard '*' or a child node of an element in the current menu interface address array, the search continues downward until the last element of the path is found, and the Data array of that node contains the menu number, indicating that the corresponding menu number set has been successfully found. If there is no matching address and no child node of the wildcard '*', it means that no matching path was found, and failure is returned.

[0018] The beneficial effects of this invention are as follows: by segmenting the menu URL path, this invention organizes the path into a tree structure, and the leaf nodes maintain the relationship between the menu path and the associated menu number. It can perform efficient data lookup through the tree structure and supports configuring wildcards to replace the menu path, thereby supporting more flexible menu address rules. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of the method flow of the present invention.

[0020] Figure 2 This is a system principle block diagram of the present invention. Detailed Implementation

[0021] The invention will now be further described with reference to the accompanying drawings.

[0022] Please see Figure 1 As shown, the present invention provides a method for managing menu permissions using routing tree wildcards, the method comprising the following steps:

[0023] Step S1: Define a RouteNode structure to represent a route tree node, containing the following fields: Path is the path of the current node, Children is a dictionary collection of child nodes, and Data is an array of associated menu numbers. Define a TreeMeta structure containing a pointer Root to the root node, which is used to store global route tree data in memory.

[0024] Step S2: Traverse all menu data in the database, split each menu path URL into an array array according to ' / ', loop through each array element, and traverse and create nodes starting from the root node Root;

[0025] Step S3: When a user accesses the menu, the system obtains the menu path URL, splits the URL into an array by ' / ', and recursively searches layer by layer from the root node of the global routing tree, matching the path of the routing tree node with the value of the path array element to find the menu number in the last element of the path.

[0026] Step S4: The system cycles through the set of menu numbers, reads the permission table to determine if the user has permission for any of the menu numbers. If the user has permission for any menu number, the process is successful; otherwise, it returns failure.

[0027] A method for managing menu permissions using route tree wildcards.

[0028] 1. Define a RouteNode structure to represent a route tree node, containing the following fields: Path is the path of the current node, Children is a dictionary collection of child nodes, and Data is an array of associated menu numbers. Define a TreeMeta structure containing a pointer Root to the root node, used to store global route tree data in memory.

[0029] For example: 1. First, define a RouteNode structure to represent a route tree node, which contains the following fields: Path is the path of the current node, Children is a dictionary collection of child nodes, and Data is an array of associated menu numbers.

[0030] / / RouteNode routing tree

[0031] type RouteNode struct{

[0032] Path string

[0033] Children map[string]*RouteNode

[0034] Data[] int / / Menu address can be repeated, so there may be multiple addresses.

[0035] }

[0036] Define another TreeMeta structure, which contains a pointer Root to the root node RouteNode, and is used to store global routing tree data in memory.

[0037] type TreeMeta struct{

[0038] Root*RouteNode

[0039] }

[0040] 2. Traverse all menu data in the database, split each menu path URL into an array by ' / ', loop through each array element, and traverse and create nodes starting from the root node Root;

[0041] Loop through each array element, starting from the root node Root, and further create nodes as follows: if a node does not exist, create a new node; if it already exists, continue moving down until the last part of the path is processed, and append the menu number to the Data array of the last route node.

[0042] For example: 2. Retrieve all menu data from the database. For instance, there are 3 menu items.

[0043] [{id:1,url:https: / / www.xxx.com / user},{id:2,url:https: / / www.xxx.com / user / *},

[0044] {id:3,url:https: / / www.bbb.com / user}].

[0045] The URL of the first menu item is split into an array `array` by ' / ', resulting in [https: / / www.xxx.com,user]. Loop through the array, define a pointer `current` pointing to the root node `Root`, and start checking from `Root`. If `current.Children` is null, initialize `current.Children`, then continue checking...

[0046] If the first element https: / / www.xxx.com exists in current.Children, then the address of the current element is added to current.Children, i.e., current.Children[https: / / www.xxx.com] =

[0047] &RouteNode{Path:https: / / www.xxx.com}, then set current to point to

[0048] `current.Children[https: / / www.xxx.com]`. Next, check if `current.Children` contains a second element, `user`. If not, add `current.Children[user]` to `&RouteNode{Path:`.

[0049] If user is the last element of the array, then add the menu number to the data Data.

[0050] current.Children[user].Data=append(current.Children[user].Data,1).

[0051] Next, loop through the second menu item https: / / www.xxx.com / user / * and convert it into an array.

[0052] {https: / / www.xxx.com,user,api}, starting the search from the root node, since the first two parts already contain nodes...

[0053] If * is the last array element, then add the menu number to the data Data, current.Children[*].Data =

[0054] append(current.Children[*].Data,2). The third menu is also added to the routing tree according to the same rules.

[0055] The code is as follows:

[0056] / / InsertRoute inserts the route into the route tree

[0057] func(rt*TreeMeta)InsertRoute(resource*en.Resource){

[0058] / / segmentation

[0059] path := resource.Path

[0060] array:=URLToArray(path,true)

[0061] count := len(array)

[0062] current:=rt.Rootfor i,part:=range array{

[0063] / / If the current node has no child nodes, create a new child node mapping.

[0064] if current.Children == nil{

[0065] current.Children=make(map[string]*RouteNode)

[0066] }

[0067] / / If the current part does not exist in the child nodes, create a new node.

[0068] if_,exists:=current.Children[part];! exists{

[0069] current.Children[part]=&RouteNode{

[0070] Path:part,

[0071] }

[0072] }

[0073] / / If it is the last node, append menu data.

[0074] if i == count-1{

[0075] if current.Children[part].Data==nil{

[0076] current.Children[part].Data=make([]int,0)

[0077] }

[0078] current.Children[part].Data=append(current.Children[part].Data,resource.ID)

[0079] }

[0080] / / Move to the child node corresponding to the current part

[0081] current=current.Children[part]

[0082] }

[0083] }

[0084] 3. When a user accesses the menu, the system obtains the menu path URL, splits the URL into an array by ' / ', and recursively searches layer by layer from the root node of the global routing tree, matching the path of the routing tree node with the value of the path array element to find the menu number in the last element of the path.

[0085] Finding the menu number in the last element of the path further involves: matching the path of the route tree node and the value of the path array element. If the current node's Children set contains a wildcard '*' or a child node of an element in the current menu interface address array, continue searching downwards until the last element of the path is found, and the Data array of that node contains the menu number, indicating that the corresponding menu number set has been successfully found; if there is no matching address and no child node of the wildcard '*', it means that no matching path was found, and failure is returned.

[0086] For example: 3 When a user accesses the menu, if a user delete operation is performed, the system obtains the accessed delete interface URL, for example, the interface address is https: / / www.xxx.com / user / 1. The URL is split into array array by ' / ' to get [https: / / www.xxx.com,user,1]. Starting from the root node of the global route tree TreeMeta, the system recursively searches and obtains the array length len to get 3. A temporary variable index=0 is defined to record the search level. Each time the search goes to the next level, it is incremented by 1. First, it checks whether Root.Children contains the node of the first element https: / / www.xxx.com. If it exists, it continues to search whether the child node of https: / / www.xxx.com exists. If it exists, it continues to search whether the child node of user exists 1. If the current route tree does not have node 1, it searches whether the child node of user exists *. Since * exists and the current search level 3 is equal to the array length 3, it returns the menu number set Data of the current node * to get the menu number array [2].

[0087] The code is as follows:

[0088] / / FindRoutes finds all routes that match a given path.

[0089] func(rt*TreeMeta)FindRoutes(path string)[]*en.Resource{

[0090] var result[]*en.Resource

[0091] / / segmentation

[0092] array:=URLToArray(path,true)

[0093] / / Define an internal recursive function to find matching routes starting from a specified node. var find func(node*RouteNode, index int)

[0094] find=func(node*RouteNode,index int){

[0095] if node == nil{

[0096] return

[0097] }

[0098] if index >= len(array) {

[0099] / / If the target level has been reached, return the data.

[0100] if node.Data! = nil{

[0101] result=append(result,node.Data...)

[0102] return

[0103] }

[0104] return

[0105] }

[0106] / / Get the path portion corresponding to the current index

[0107] part := array[index]

[0108] / / If the current node has child nodes in this path, continue searching downwards. if child, exists := node.Children[part]; exists{

[0109] find(child, index+1)

[0110] }

[0111] / / If the current node has a wildcard (*) child node, continue searching downwards. if wildcardChild, exists:= node.Children["*"]; exists{f ind(wildcardChild,index+1)

[0112] }

[0113] }

[0114] / / Search for matching paths starting from the root node

[0115] find(rt.Root,0)

[0116] return result

[0117] }

[0118] 4. The system cycles through the set of menu numbers, reads the permission table to determine if the user has permission for any of the menu numbers. If the user has permission for any of the menu numbers, the process is successful; otherwise, it returns failure.

[0119] For example: The system loops through the menu number array [2], reads the permission table to determine whether the current user has permission for the menu number array [2]. If so, it returns success; otherwise, it returns failure. If the menu number set contains multiple menu numbers, it returns success if the user has permission for any of the menu numbers.

[0120] Please see Figure 2 As shown, the present invention also provides a system for managing menu permissions using routing tree wildcards, the system including the definition module, node creation module, menu number lookup module and permission verification module;

[0121] The definition module defines a RouteNode structure to represent a route tree node, containing the following fields: Path for the current node's path, Children for the dictionary of child nodes, and Data for the array of associated menu numbers. It also defines a TreeMeta structure containing a pointer Root to the root node, used to store global route tree data in memory.

[0122] For example: 1. First, define a RouteNode structure to represent a route tree node, which contains the following fields: Path is the path of the current node, Children is a dictionary collection of child nodes, and Data is an array of associated menu numbers.

[0123] / / RouteNode routing tree

[0124] type RouteNode struct{

[0125] Path string

[0126] Children map[string]*RouteNode

[0127] Data[] int / / Menu address can be repeated, so there may be multiple addresses.

[0128] }

[0129] Define another TreeMeta structure, which contains a pointer Root to the root node RouteNode, and is used to store global routing tree data in memory.

[0130] type TreeMeta struct{

[0131] Root*RouteNode

[0132] }

[0133] The node creation module iterates through all menu data in the database, splits each menu path URL into an array according to ' / ', loops through each array element, and iterates and creates nodes starting from the root node Root.

[0134] Loop through each array element, starting from the root node Root, and further create nodes as follows: if a node does not exist, create a new node; if it already exists, continue moving down until the last part of the path is processed, and append the menu number to the Data array of the last route node.

[0135] For example: 2. Retrieve all menu data from the database. For instance, there are 3 menu items.

[0136] [{id:1,url:https: / / www.xxx.com / user},{id:2,url:https: / / www.xxx.com / user / *},

[0137] {id:3,url:https: / / www.bbb.com / user}].

[0138] The URL of the first menu item is split into an array `array` by ' / ', resulting in [https: / / www.xxx.com,user]. Loop through the array, define a pointer `current` pointing to the root node `Root`, and start checking from `Root`. If `current.Children` is null, initialize `current.Children`, then continue checking...

[0139] If the first element https: / / www.xxx.com exists in current.Children, then the address of the current element is added to current.Children, i.e., current.Children[https: / / www.xxx.com] =

[0140] &RouteNode{Path:https: / / www.xxx.com}, then set current to point to

[0141] `current.Children[https: / / www.xxx.com]`. Next, check if `current.Children` contains a second element, `user`. If not, add `current.Children[user]` to `&RouteNode{Path:`.

[0142] If user is the last element of the array, then add the menu number to the data Data.

[0143] current.Children[user].Data=append(current.Children[user].Data,1).

[0144] Next, loop through the second menu item https: / / www.xxx.com / user / * and convert it into an array.

[0145] {https: / / www.xxx.com,user,api}, starting from the root node, since the first two parts already have nodes, and * is the last array element, the menu number is added to the data Data: current.Children[*].Data = append(current.Children[*].Data,2). The third menu is added to the route tree according to the same rules.

[0146] The code is as follows:

[0147] / / InsertRoute inserts the route into the route tree

[0148] func(rt*TreeMeta)InsertRoute(resource*en.Resource){

[0149] / / segmentation

[0150] path := resource.Path

[0151] array:=URLToArray(path,true)

[0152] count := len(array)

[0153] current:=rt.Rootfor i,part:=range array{

[0154] / / If the current node has no child nodes, create a new child node mapping.

[0155] if current.Children == nil{

[0156] current.Children=make(map[string]*RouteNode)

[0157] }

[0158] / / If the current part does not exist in the child nodes, create a new node.

[0159] if_,exists:=current.Children[part];! exists{

[0160] current.Children[part]=&RouteNode{

[0161] Path:part,

[0162] }

[0163] }

[0164] / / If it is the last node, append menu data.

[0165] if i == count-1{

[0166] if current.Children[part].Data==nil{

[0167] current.Children[part].Data=make([]int,0)

[0168] }

[0169] current.Children[part].Data=append(current.Children[part].Data,

[0170] resource.ID)

[0171] }

[0172] / / Move to the child node corresponding to the current part

[0173] current=current.Children[part]

[0174] }

[0175] }

[0176] The menu number lookup module works as follows: When a user accesses a menu, the system obtains the menu path URL, splits the URL into an array by ' / ', and recursively searches layer by layer from the root node of the global routing tree, matching the path of the routing tree node with the value of the path array element to find the menu number in the last element of the path.

[0177] Finding the menu number in the last element of the path further involves: matching the path of the route tree node and the value of the path array element. If the current node's Children set contains a wildcard '*' or a child node of an element in the current menu interface address array, continue searching downwards until the last element of the path is found, and the Data array of that node contains the menu number, indicating that the corresponding menu number set has been successfully found; if there is no matching address and no child node of the wildcard '*', it means that no matching path was found, and failure is returned.

[0178] For example: 3 When a user accesses the menu, if a user delete operation is performed, the system obtains the accessed delete interface URL, for example, the interface address is https: / / www.xxx.com / user / 1. The URL is split into array array by ' / ' to get [https: / / www.xxx.com,user,1]. Starting from the root node of the global route tree TreeMeta, the system recursively searches and obtains the array length len to get 3. A temporary variable index=0 is defined to record the search level. Each time the search goes to the next level, it is incremented by 1. First, it checks whether Root.Children contains the node of the first element https: / / www.xxx.com. If it exists, it continues to search whether the child node of https: / / www.xxx.com exists. If it exists, it continues to search whether the child node of user exists 1. If the current route tree does not have node 1, it searches whether the child node of user exists *. Since * exists and the current search level 3 is equal to the array length 3, it returns the menu number set Data of the current node * to get the menu number array [2].

[0179] The code is as follows:

[0180] / / FindRoutes finds all routes that match a given path.

[0181] func(rt*TreeMeta)FindRoutes(path string)[]*en.Resource{var result[]*en.Resource

[0182] / / segmentation

[0183] array:=URLToArray(path,true)

[0184] / / Define an internal recursive function to find matching routes starting from a specified node. var find func(node*RouteNode, index int)

[0185] find=func(node*RouteNode,index int){

[0186] if node == nil{

[0187] return

[0188] }

[0189] if index >= len(array) {

[0190] / / If the target level has been reached, return the data.

[0191] if node.Data! = nil{

[0192] result=append(result,node.Data...)

[0193] return

[0194] }

[0195] return

[0196] }

[0197] / / Get the path portion corresponding to the current index

[0198] part := array[index]

[0199] / / If the current node has child nodes of this path, continue searching downwards.

[0200] if child,exists:=node.Children[part];exists{

[0201] find(child, index+1)

[0202] }

[0203] / / If the current node has a wildcard (*) child node, continue searching downwards.

[0204] if wildcardChild,exists:=node.Children["*"];exists{

[0205] f ind(wildcardChild,index+1)

[0206] }

[0207] }

[0208] / / Search for matching paths starting from the root node

[0209] find(rt.Root,0)

[0210] return result

[0211] }

[0212] The permission verification module: The system cycles through the set of menu numbers, reads the permission table to determine whether the user has permission for any menu number. If the user has permission for any menu number, the process is successful; otherwise, it returns failure.

[0213] For example: The system loops through the menu number array [2], reads the permission table to determine whether the current user has permission for the menu number array [2]. If so, it returns success; otherwise, it returns failure. If the menu number set contains multiple menu numbers, it returns success if the user has permission for any of the menu numbers.

[0214] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should be included in the scope of the present invention.

Claims

1. A method for managing menu permissions using routing tree wildcards, characterized in that: The method includes the following steps: Step S1: Define a RouteNode structure to represent a route tree node, containing the following fields: Path is the path of the current node, Children is a dictionary collection of child nodes, and Data is an array of associated menu numbers. Define a TreeMeta structure containing a pointer Root to the root node, which is used to store global route tree data in memory. Step S2: Traverse all menu data in the database, split each menu path URL into an array array according to ' / ', loop through each array element, and traverse and create nodes starting from the root node Root; Step S3: When a user accesses the menu, the system obtains the menu path URL, splits the URL into an array by ' / ', and recursively searches layer by layer from the root node of the global routing tree, matching the path of the routing tree node with the value of the path array element to find the menu number in the last element of the path. Step S4: The system cycles through the set of menu numbers, reads the permission table to determine if the user has permission for any menu number. If the user has permission for any menu number, the process is successful; otherwise, it returns failure. The step S3 of finding the menu number in the last element of the path further involves: matching the path of the routing tree node and the value of the path array element. If the current node's Children set contains a wildcard '*' or a child node of an element in the current menu interface address array, the search continues downwards until the last element of the path is found, and the Data array of that node contains the menu number, indicating that the corresponding menu number set has been successfully found. If there is no matching address and no child node of the wildcard '*', it means that no matching path was found, and failure is returned.

2. The method for managing menu permissions using routing tree wildcards according to claim 1, characterized in that: In step S2, looping through each array element, starting from the root node Root, and creating nodes further involves: if a node does not exist, creating a new node; if it already exists, continuing to move downwards until the last part of the path is processed, and appending the menu number to the Data array of the last route node.

3. A system for managing menu permissions using routing tree wildcards, characterized in that: The system includes a definition module, a node creation module, a menu number search module, and a permission verification module. The definition module defines a RouteNode structure to represent a route tree node, containing the following fields: Path for the current node's path, Children for the dictionary of child nodes, and Data for the array of associated menu numbers. It also defines a TreeMeta structure containing a pointer Root to the root node, used to store global route tree data in memory. The node creation module iterates through all menu data in the database, splits each menu path URL into an array according to ' / ', loops through each array element, and iterates and creates nodes starting from the root node Root. The menu number lookup module works as follows: When a user accesses a menu, the system obtains the menu path URL, splits the URL into an array by ' / ', and recursively searches layer by layer from the root node of the global routing tree, matching the path of the routing tree node with the value of the path array element to find the menu number in the last element of the path. The permission verification module: The system cycles through the set of menu numbers, reads the permission table to determine whether the user has permission for any menu number. If the user has permission for any menu number, the process is successful; otherwise, it returns failure. The menu number lookup module further finds the menu number in the last element of the path by matching the path of the route tree node and the value of the path array element. If the current node's Children set contains a wildcard '*' or a child node of an element in the current menu interface address array, the search continues downward until the last element of the path is found, and the Data array of that node contains the menu number, indicating that the corresponding menu number set has been successfully found. If there is no matching address and no child node of the wildcard '*', it means that no matching path was found, and failure is returned.

4. A system for managing menu permissions using routing tree wildcards according to claim 3, characterized in that, The node creation module iterates through each array element, starting from the root node, and creates nodes by: if a node does not exist, creating a new node; if a node already exists, continuing to move downwards until the last part of the path is processed, and appending the menu number to the Data array of the last route node.

Citation Information

Patent Citations

  • Webpage dynamic menu generation method and device

    CN106598591A

  • Authority management method and device, equipment and storage medium

    CN115577344A