Role permission configuration method and device, equipment and storage medium
By matching and reorganizing the menu tree, and updating the role permission tree from bottom to top, the problem of low permission configuration after menu reconstruction in the existing technology is solved, and intelligent permission update and efficient configuration after menu tree reconstruction is realized.
Patent Information
- Application Number
- CN202411171973.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-08-23
AI Technical Summary
When refactoring the menu function module of the existing permission management system, it is necessary to manually change the permissions of each role, and the configuration efficiency is low and it is impossible to effectively improve the configuration efficiency of role permissions.
By obtaining the original menu tree before reconstruction and the expected menu tree after reconstruction, match the modified target child nodes and leaf nodes, reorganize the original menu tree based on these nodes, obtain the role permission tree, and match from bottom to top To update the role permissions, generate the refactored permission tree.
After the menu tree is reconstructed, the role permissions are intelligently updated, which simplifies the configuration operation of role permissions, greatly improves the configuration efficiency, and avoids manually changing the permissions of each role.
Smart Images

Figure CN119128842A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data updating, and in particular to a method, apparatus, device and storage medium for configuring role permissions. Background Art
[0002] Currently, the update of the permission management system is closely related to the changes in company personnel. When personnel change in different departments and positions, it is necessary to isolate and update user permissions in the permission management system. In the current permission management system, when reclassifying and reconstructing the functional modules of the menu, it is necessary to manually change the permissions of each role corresponding to the permissions of the new menu, which has low configuration efficiency. Therefore, how to improve the configuration efficiency of role permissions is an urgent problem to be solved. Summary of the invention
[0003] The main purpose of this application is to provide a role authority configuration method, device, equipment and storage medium, aiming to improve the configuration efficiency of role authority.
[0004] In a first aspect, the present application provides a method for configuring role permissions, comprising:
[0005] Acquire a first menu tree and a second menu tree; wherein the first menu tree is the original menu tree before reconstruction, and the second menu tree is the desired menu tree after reconstruction;
[0006] Matching the first menu tree with the second menu tree to identify a target child node and a target leaf node where modifications are made;
[0007] Based on the target child node and the target leaf node, the first menu tree is reorganized to obtain a third menu tree;
[0008] Obtaining a first role permission tree, where the first role permission tree is used to represent the original permissions of the set role before the first menu tree is reconstructed, and the first role permission tree includes some child nodes and some leaf nodes in the first menu tree;
[0009] According to the leaf nodes in the first role permission tree, the third menu tree is matched from bottom to top to obtain a second role permission tree; the second role permission tree is used to represent the target permissions of the set role after the first menu tree is reconstructed, and the second role permission tree includes some child nodes and some leaf nodes in the third menu tree.
[0010] In a second aspect, the present application further provides a role authority configuration device, the role authority configuration device comprising:
[0011] An acquisition module, used for acquiring a first menu tree and a second menu tree; wherein the first menu tree is an original menu tree before reconstruction, and the second menu tree is a desired menu tree after reconstruction;
[0012] A matching module, used for matching the first menu tree with the second menu tree to identify a target child node and a target leaf node where modifications exist;
[0013] A reorganization module, used for reorganizing the first menu tree based on the target child node and the target leaf node to obtain a third menu tree;
[0014] The acquisition module is further used to acquire a first role permission tree, where the first role permission tree is used to represent the original permissions of the set role before the first menu tree is reconstructed, and the first role permission tree includes some child nodes and some leaf nodes in the first menu tree;
[0015] The matching module is also used to match the third menu tree from bottom to top according to the leaf nodes in the first role permission tree to obtain a second role permission tree; the second role permission tree is used to represent the target permissions of the set role after the first menu tree is reconstructed, and the second role permission tree includes some child nodes and some leaf nodes in the third menu tree.
[0016] In a third aspect, the present application also provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the role authority configuration method as described in the embodiment of the present application is implemented.
[0017] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the role authority configuration method as described in the embodiment of the present application is implemented.
[0018] The present application provides a role permission configuration method, by matching the first menu tree before reconstruction with the second menu tree after reconstruction, thereby identifying the target subnode and target leaf node that have been modified; then reorganizing the first menu tree based on the target subnode and the target leaf node to obtain a third menu tree; then obtaining the first role permission tree used to characterize the original permissions of the set role before reconstruction, matching the third menu tree from bottom to top according to the leaf nodes in the first role permission tree, and obtaining the second role permission tree used to characterize the set role after reconstruction, wherein the second role permission tree includes some subnodes and some leaf nodes in the third menu tree. Therefore, the present application can intelligently implement the update of the role permission tree after the menu tree is reconstructed, thereby simplifying the configuration operation of the role permission. At the same time, there is no need to manually change the permissions of each role corresponding to the permissions of the new menu, thus greatly improving the configuration efficiency of the role permissions. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1 A schematic diagram of the steps of a role authority configuration method provided in an embodiment of the present application;
[0021] Figure 2 A schematic diagram of a first menu tree provided in an embodiment of the present application;
[0022] Figure 3 A schematic diagram of a second menu tree provided in an embodiment of the present application;
[0023] Figure 4 A schematic diagram of a fourth menu tree provided in an embodiment of the present application;
[0024] Figure 5 A schematic block diagram of a role authority configuration device provided in an embodiment of the present application;
[0025] Figure 6 A schematic block diagram of another role authority configuration device provided in an embodiment of the present application;
[0026] Figure 7 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application.
[0027] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0028] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0029] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0030] The embodiments of the present application provide a method, device, equipment and storage medium for configuring role permissions. The method for configuring role permissions can be applied to a terminal device or a server. The terminal device can be an electronic device such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, a personal digital assistant and a wearable device. The server can be a single server or a server cluster composed of multiple servers. The following explanation is given by taking the application of the method for configuring role permissions to a server as an example.
[0031] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0032] Please refer to Figure 1 , Figure 1 A schematic diagram of the steps of a role permission configuration method provided in an embodiment of the present application.
[0033] like Figure 1 As shown, the role authority configuration method includes steps S101 to S105.
[0034] Step S101, obtaining a first menu tree and a second menu tree; wherein the first menu tree is the original menu tree before reconstruction, and the second menu tree is the desired menu tree after reconstruction.
[0035] Among them, the first menu tree and the second menu tree are tree structure data, and the first menu tree and the second menu tree both include multiple child nodes (Branch Node) and multiple leaf nodes (Leaf Node). A child node refers to a node whose degree is not 0, also called a non-terminal node or an internal node. A leaf node refers to a node whose degree is 0, also called a terminal node. For the permission management system, the child nodes and leaf nodes in the first menu tree and the second menu tree are respectively used to represent permissions at different levels.
[0036] It should be noted that the second menu tree is obtained after the user reconstructs the child nodes and leaf nodes in the first menu tree. The first menu tree and the second menu tree can be exported from the authority management system using a dedicated tool, and the data format of the exported first menu tree and the second menu tree can be Excel, YAML (YAML Ain't MarkupLanguage, another markup language) and other formats.
[0037] In some cases, users need to reconstruct the function modules of the menu, which includes hierarchical changes, renaming, deletion, and addition of child nodes or leaf nodes. Therefore, the original menu tree refers to the menu tree configured before the reconstruction, and the expected menu tree refers to the menu tree expected to be configured after the reconstruction.
[0038] In one embodiment, a first menu tree is displayed, and the first menu tree includes a plurality of child nodes and a plurality of leaf nodes; based on the user's reconstruction operation on the child nodes and leaf nodes in the first menu tree, a second menu tree is obtained. The reconstruction operation includes hierarchical changes, renaming, deletion, and addition of child nodes or leaf nodes. Therefore, the user only needs to configure the desired second menu tree based on the first menu tree, so that the original menu tree can be easily modified according to actual needs, and the original menu tree can be modified into the desired desired menu tree.
[0039] For example, Figure 2 As shown, Figure 2 This is a schematic diagram of the first menu tree before reconstruction. The first menu tree includes multiple sub-nodes or multiple leaf nodes corresponding to the three levels of authority. Among them, the sub-node corresponding to the first-level authority is "Homepage". The sub-nodes corresponding to the second-level authority are "Institutional Risk Profile", "Warning Rating" and "Industry Risk Profile". The leaf nodes corresponding to the third-level authority include "Risk Profile" and "Indicator Management" corresponding to "Institutional Risk Profile", "Indicator Management" corresponding to "Warning Rating", and "Risk Profile" and "Indicator Management" corresponding to "Industry Risk Profile".
[0040] For example, Figure 3 As shown, Figure 3 It is a schematic diagram of the reconstructed second menu tree. The second menu tree includes multiple sub-nodes or multiple leaf nodes corresponding to the three levels of authority. Among them, the sub-node corresponding to the first-level authority is "Homepage". The sub-nodes corresponding to the second-level authority are "Organization Portrait", "Special Risk" and "Warning Portrait". The leaf nodes corresponding to the third-level authority include "Risk Portrait" and "Indicator Management" corresponding to "Organization Portrait", "Reputation Risk Portrait" corresponding to "Special Risk", and "Warning Rating" and "Indicator Management" corresponding to "Warning Portrait".
[0041] Step S102: Match the first menu tree with the second menu tree to identify the target child node and target leaf node that have been modified.
[0042] Wherein, both the first menu tree and the second menu tree include a plurality of child nodes and a plurality of leaf nodes, and the second menu tree can be obtained by reconstructing the child nodes and leaf nodes in the first menu tree. Therefore, matching the first menu tree with the second menu tree can be matching the plurality of child nodes and the plurality of leaf nodes in the first menu tree with the plurality of child nodes and the plurality of leaf nodes in the second menu tree, so as to obtain the target child nodes and the target leaf nodes that are modified compared with the first menu tree.
[0043] In one embodiment, the first menu tree is matched with the second menu tree to identify modified target child nodes and target leaf nodes, including: matching multiple child nodes and leaf nodes in the first menu tree and the second menu tree to obtain matching results; obtaining newly added, modified, renamed, and deleted child nodes as target child nodes based on the matching results, and obtaining newly added, modified, renamed, and deleted leaf nodes as target leaf nodes based on the matching results.
[0044] The child nodes and leaf nodes may be matched by a unique identification number, by a corresponding permission name, or according to the level at which the node is located, which is not specifically limited in the embodiments of the present application. The matching results may include the same unique identification number, different unique identification numbers, the same permission name, different permission names, the same level, different levels, etc.
[0045] It should be noted that, based on the matching results, the subnodes and leaf nodes with modified levels, renamed, or deleted can be identified and determined as the target subnodes and target leaf nodes with modified levels. For example, the subnodes or leaf nodes with the same unique identification number but different levels are the target subnodes and target leaf nodes with modified levels, and the subnodes or leaf nodes with the same unique identification number but inconsistent permission names are the target subnodes and target leaf nodes with renamed names.
[0046] Exemplarily, there may be multiple matching results, and the newly added and deleted target child nodes and target leaf nodes may be determined based on the multiple matching results. Specifically, it may be determined based on the multiple matching results whether a certain unique identification number exists in the first menu tree, and whether a certain unique identification number exists in the second menu tree, thereby determining the newly added and deleted target child nodes and target leaf nodes. In some cases, the child nodes or leaf nodes in which a certain unique identification number exists in the first menu tree and the second menu tree does not have the certain unique identification number are the deleted target child nodes and target leaf nodes, respectively. The child nodes or leaf nodes in which a certain unique identification number does not exist in the first menu tree and the second menu tree has the certain unique identification number are the newly added target child nodes and target leaf nodes, respectively.
[0047] In one embodiment, the first menu tree is matched with the second menu tree to identify modified target subnodes and target leaf nodes, including: matching each subnode in the first menu tree with multiple subnodes and leaf nodes in the second menu tree to obtain modified, renamed, deleted target subnodes and unmodified subnodes; and matching each leaf node in the first menu tree with multiple subnodes and leaf nodes in the second menu tree to obtain modified, renamed, deleted target leaf nodes and unmodified leaf nodes; determining newly added target subnodes and newly added target leaf nodes from multiple subnodes and multiple leaf nodes in the second menu tree based on the target subnodes, unmodified subnodes, target leaf nodes and unmodified leaf nodes.
[0048] It should be noted that each subnode in the first menu tree is matched with multiple subnodes and leaf nodes in the second menu tree, and each leaf node in the first menu tree is matched with multiple subnodes and leaf nodes in the second menu tree, so as to identify the target subnodes with modified levels, renamed, deleted and unmodified subnodes, and identify the target leaf nodes with modified levels, renamed, deleted and unmodified leaf nodes. After determining that there are modified target subnodes, target leaf nodes and unmodified subnodes and unmodified leaf nodes, the remaining subnodes in the second menu tree are newly added target subnodes, and the remaining leaf nodes in the second menu tree are newly added target leaf nodes. In this way, the modified target subnodes and target leaf nodes can be accurately identified.
[0049] Exemplarily, each child node in the first menu tree is matched with multiple child nodes and leaf nodes in the second menu tree to obtain a target child node to be renamed, including: obtaining the first permission name and first identification number of each child node in the first menu tree, and obtaining the second permission name and second identification number of multiple child nodes and leaf nodes in the second menu tree; matching the first identification number of each child node in the first menu tree with multiple second identification numbers in the second menu tree to determine a target identification number from each first identification number, and the target identification number matches the second identification number; comparing the first permission name corresponding to the target identification number with the second permission name, and determining each child node corresponding to the target identification number that is inconsistent in the comparison as the target child node to be renamed.
[0050] It should be noted that when matching the first menu tree with the second menu tree, the matching can be based on the unique identification number, permission name, level and other features of each child node and each leaf node. For example, when identifying the target child node to be renamed, the first identification number of each child node in the first menu tree can be matched with multiple second identification numbers in the second menu tree, so as to identify the target identification number that matches the second identification number from each first identification number, and determine the child node whose first permission name of the target identification number is inconsistent with the second permission name as the target child node to be renamed. In this way, the target child node that has been renamed can be accurately identified.
[0051] It can be understood that the relevant steps of "matching each leaf node in the first menu tree with multiple sub-nodes and leaf nodes in the second menu tree to obtain the target leaf node to be renamed" in the above embodiment can refer to the corresponding process of the relevant examples, so as to accurately identify the target leaf node to be renamed, and the embodiments of the present application will not go into details about this.
[0052] In one embodiment, the first menu tree is matched with the second menu tree to identify modified target subnodes and target leaf nodes, including: matching each subnode in the second menu tree with multiple subnodes and leaf nodes in the first menu tree to obtain modified, renamed, and newly added target subnodes and unmodified subnodes; and matching each leaf node in the second menu tree with multiple subnodes and leaf nodes in the first menu tree to obtain modified, renamed, and newly added target leaf nodes and unmodified leaf nodes; determining the deleted target subnodes and deleted target leaf nodes from multiple subnodes and multiple leaf nodes in the first menu tree based on the target subnodes, unmodified subnodes, target leaf nodes, and unmodified leaf nodes.
[0053] It should be noted that each subnode in the second menu tree is matched with multiple subnodes and leaf nodes in the first menu tree, and each leaf node in the second menu tree is matched with multiple subnodes and leaf nodes in the first menu tree, so that the modified, renamed, newly added target subnodes and unmodified subnodes can be identified, as well as the modified, renamed, newly added target leaf nodes and unmodified leaf nodes. After determining that there are modified target subnodes, target leaf nodes, and unmodified subnodes and unmodified leaf nodes, the remaining subnodes in the first menu tree are the target subnodes to be deleted, and the remaining leaf nodes in the first menu tree are the target leaf nodes to be deleted. In this way, the modified target subnodes and target leaf nodes can be accurately identified.
[0054] In one embodiment, when matching the first menu tree with the second menu tree, it is checked whether there are child nodes or leaf nodes that cannot be uniquely determined; if so, an abnormal prompt message is generated and output, and the abnormal prompt message is used to prompt the administrator to specify a unique child node or leaf node.
[0055] Among them, the uniquely determined child node or leaf node may refer to a child node or leaf node with the same permission name but without a unique identification number, or may refer to a child node or leaf node that cannot be uniquely locked according to the hierarchy, and the embodiment of the present application does not specifically limit this. Through the abnormal prompt information, when a child node or leaf node has an abnormality, it can be uniformly processed, greatly improving the processing efficiency of the permission configuration process.
[0056] Step S103: reorganize the first menu tree based on the target child node and the target leaf node to obtain a third menu tree.
[0057] Since the target sub-nodes and target leaf nodes are modified sub-nodes and leaf nodes obtained by reconstruction based on the first menu tree, in order to subsequently clarify the relationship between the role authority-related nodes before and after the reconstruction, it is necessary to reorganize the first menu tree based on the target sub-nodes and the target leaf nodes, thereby obtaining a third menu tree that can represent the node changes before and after the reconstruction of the first menu tree.
[0058] It should be noted that when the first menu tree is reorganized, it can be based on the set logic. The set logic can be, for example, adding, renaming and changing the level, and finally deleting, so as to obtain the reorganized third menu tree. The third menu tree is used to associate the subsequent first role permission tree and the second role permission tree, so that the original permissions of the set role before the reconstruction can be converted into the target permissions after the reconstruction.
[0059] In one embodiment, the first menu tree is reorganized based on the target sub-nodes and the target leaf nodes to obtain the third menu tree, including: adding newly added target sub-nodes and target leaf nodes to the first menu tree to obtain the first sub-expected menu tree; based on the target sub-nodes and target leaf nodes of the modified hierarchy, the corresponding nodes in the first sub-expected menu tree are hierarchically modified to obtain the second sub-expected menu tree; based on the renamed target sub-nodes and target leaf nodes, the corresponding nodes in the second sub-expected menu tree are renamed to obtain the third sub-expected menu tree; based on the deleted target sub-nodes and target leaf nodes, the corresponding nodes in the third sub-expected menu tree are deleted to obtain the third menu tree.
[0060] It should be noted that the first menu tree is reorganized based on the set logic, that is, multiple child nodes and leaf nodes in the first menu tree are added, modified in level, renamed, and deleted respectively, so as to obtain the third menu tree. In some cases, the set logic can be flexibly adjusted, such as first renaming, then modifying the level, and then adding and deleting operations. The embodiment of the present application does not make specific limitations on this. It is understandable that the first menu tree is reorganized by the set logic of adding, modifying the level, renaming, and deleting operations, which can improve the generation efficiency of the third menu tree.
[0061] In one embodiment, the role permission configuration method further includes: based on the target child node and the target leaf node, the first menu tree is marked to obtain a fourth menu tree, and the fourth menu tree is displayed. Specifically, in the first menu tree, the newly added, modified, renamed, and deleted target child nodes and target leaf nodes are all marked.
[0062] Among them, the identification methods of each newly added, modified, renamed, or deleted target child node and target leaf node can be different and can be flexibly set, and then the fourth menu tree is displayed. By clearly identifying the newly added, modified, renamed, or deleted nodes, it is convenient for the administrator to confirm whether the reconstructed expected menu tree is the desired effect, and the new and old menus can be compared at a glance to confirm which nodes have been changed, prevent misoperation, and thus improve accuracy.
[0063] For example, Figure 4 As shown, Figure 4 The fourth menu tree is a schematic diagram. The blue background (the darkest background in the figure) indicates the newly added target sub-node, the yellow background (the dark background in the figure) indicates the renamed target sub-node, the [ ] is the original permission name, the bold font indicates that the level has changed, and the unique identification number is in brackets. Figure 2 , Figure 3 The new and old menu trees are compared. Figure 4The fourth menu tree shown is very intuitive, allowing users to clearly understand their modifications and avoid omissions.
[0064] Step S104: Obtain a first role permission tree, where the first role permission tree is used to represent the original permissions of the set role before the first menu tree is reconstructed.
[0065] The first role permission tree includes some child nodes and some leaf nodes in the first menu tree, that is, the first role permission tree belongs to the part of the first menu tree. It can be understood that multiple role permission trees for set roles can be set in the permission management system, and the first role permission tree can be the role permission tree of any set role among the multiple set roles.
[0066] In one embodiment, after obtaining the first role permission tree, it also includes: parsing whether there are missing leaf nodes in the first role permission tree; when there are missing leaf nodes in the first role permission tree, clearing the child nodes corresponding to the missing leaf nodes.
[0067] It should be noted that, in the first role permission tree, if there is a missing leaf node, it means that the child node corresponding to the missing leaf node is invalid data and needs to be cleared, so as to prevent the permission that is not set or revoked by the set role from being granted in subsequent steps.
[0068] Step S105: Match the third menu tree from bottom to top according to the leaf nodes in the first role permission tree to obtain a second role permission tree; the second role permission tree is used to represent the target permission of the set role after the first menu tree is reconstructed.
[0069] Among them, the second role permission tree includes some child nodes and some leaf nodes in the third menu tree, that is, the second role permission tree belongs to the part of the third menu tree. Bottom-up matching refers to the matching order from the leaf nodes of the third menu tree to the child nodes corresponding to the leaf nodes. After the original menu tree is reconstructed, it indicates that some child nodes and some leaf nodes in the first menu tree and the second menu tree have been modified. At this time, there are usually differences between the second role permission tree and some child nodes and some leaf nodes in the first role permission tree.
[0070] Therefore, according to the leaf nodes in the first role permission tree, the third menu tree is matched from bottom to top to obtain the second role permission tree. Thus, the update of the role permission tree of the set role is intelligently realized, thereby simplifying the configuration operation of the role permission. At the same time, there is no need to manually change the permissions of each role corresponding to the permissions of the new menu, thus greatly improving the configuration efficiency of the role permissions.
[0071] It can be understood that when there are multiple set roles, the embodiment of the present application supports batch modification of role permission trees of different set roles, thereby intelligently implementing permission changes for multiple set roles. There is no need to manually change the permissions of each role corresponding to the permission modification of the new menu tree, thereby greatly improving the configuration efficiency of role permissions.
[0072] In one embodiment, the third menu tree is matched from bottom to top according to the leaf nodes in the first role permission tree to obtain the second role permission tree, including: matching each leaf node in the first role permission tree with each leaf node in the third menu tree to determine a candidate leaf node in the third menu tree, and the candidate leaf node matches the child node in the first role permission tree; determining in the third menu tree the candidate child node corresponding to the candidate leaf node in the third menu tree; and determining the second role permission tree based on the candidate leaf nodes and the candidate child nodes in the third menu tree.
[0073] It should be noted that after obtaining the first role permission tree, the leaf nodes in the first role permission tree are matched with the leaf nodes in the third menu tree, and the permissions of the set role in the third menu tree are determined from bottom to top to obtain the second role permission tree, thereby being able to intelligently update the role permission tree without manually changing the permissions of each role to correspond to the permissions of the new menu, thereby simplifying the configuration operation of role permissions and greatly improving the configuration efficiency of role permissions.
[0074] In one embodiment, the method also includes: obtaining a first personalized permission tree, the first personalized permission tree is used to represent the original permissions of the set character before the first menu tree is reconstructed, and the first personalized permission tree includes some child nodes and some leaf nodes in the first role permission tree; according to the leaf nodes in the first personalized permission tree, the third menu tree is matched from bottom to top to obtain a second personalized permission tree; the second personalized permission tree is used to represent the target permissions of the set character after the first menu tree is reconstructed, and the second personalized permission tree includes some child nodes and some leaf nodes in the third menu tree.
[0075] The set person is a specific person under the set role, the set role may refer to a job role, and the set person may be a specific person of the job role. The permissions of the set person and the set role may be the same or different, so the personalized permission tree of the set person and the role permission tree of the set role may also be the same or different. In some cases, the personalized permission tree of the set person is different from the role permission tree of the set role, so after configuring the role permission tree, the personalized permission tree also needs to be configured.
[0076] It should be noted that the first personalized permission tree includes some child nodes and some leaf nodes in the first role permission tree, and the second personalized permission tree includes some child nodes and some leaf nodes in the third menu tree. By matching the third menu tree from bottom to top according to the leaf nodes in the first personalized permission tree, the second personalized permission tree can be accurately and quickly obtained. The bottom-up matching process can refer to the corresponding process of generating the second role permission tree, and the embodiment of the present application does not specifically limit this.
[0077] In one embodiment, after obtaining the second role permission tree, a refresh system operation is performed to clear the system cache so that the second role permission tree can take effect immediately, thereby improving the reliability of the configuration operation of the role permission.
[0078] In one embodiment, the first menu tree is backed up, so that when the user is not satisfied with the second menu tree or the second role permission tree, the first menu tree can still be rolled back, thereby improving the security of the configuration operation of the role permission.
[0079] It should be noted that in order to further ensure the privacy and security of the above-mentioned first role permission tree, second role permission tree and other related information, the above-mentioned first role permission tree, second role permission tree and other related information can also be stored in a node of a blockchain. The technical solution of the present application can also be applied to adding other data files stored on the blockchain. The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm.
[0080] The role permission configuration method provided by the above embodiment matches the first menu tree before reconstruction with the second menu tree after reconstruction, so as to identify the target subnode and target leaf node that have been modified; then the first menu tree is reorganized based on the target subnode and the target leaf node to obtain a third menu tree; then the first role permission tree used to characterize the original permissions of the set role before reconstruction is obtained, and the third menu tree is matched from bottom to top according to the leaf nodes in the first role permission tree to obtain the second role permission tree used to characterize the set role after reconstruction, wherein the second role permission tree includes some subnodes and some leaf nodes in the third menu tree. Therefore, the present application can intelligently implement the update of the role permission tree after the menu tree is reconstructed, thereby simplifying the configuration operation of the role permission. At the same time, there is no need to manually change the permissions of each role corresponding to the permissions of the new menu, thus greatly improving the configuration efficiency of the role permissions.
[0081] Please refer to Figure 5 , Figure 5 A schematic block diagram of a role authority configuration device provided in an embodiment of the present application.
[0082] like Figure 5As shown, the role authority configuration device 200 includes:
[0083] An acquisition module 201 is used to acquire a first menu tree and a second menu tree; wherein the first menu tree is an original menu tree before reconstruction, and the second menu tree is a desired menu tree after reconstruction;
[0084] A matching module 202, configured to match the first menu tree with the second menu tree to identify a target child node and a target leaf node that have been modified;
[0085] A reorganization module 203, configured to reorganize the first menu tree based on the target child node and the target leaf node to obtain a third menu tree;
[0086] The acquisition module 201 is further used to acquire a first role permission tree, where the first role permission tree is used to represent the original permissions of the set role before the first menu tree is reconstructed, and the first role permission tree includes some child nodes and some leaf nodes in the first menu tree;
[0087] The matching module 202 is also used to match the third menu tree from bottom to top according to the leaf nodes in the first role permission tree to obtain a second role permission tree; the second role permission tree is used to represent the target permissions of the set role after the first menu tree is reconstructed, and the second role permission tree includes some child nodes and some leaf nodes in the third menu tree.
[0088] In one embodiment, the matching module 202 is further configured to:
[0089] Matching the first menu tree with the plurality of child nodes and leaf nodes in the second menu tree to obtain a matching result;
[0090] According to the matching result, a newly added, modified, renamed, or deleted child node is obtained as the target child node, and a newly added, modified, renamed, or deleted leaf node is obtained according to the matching result as the target leaf node.
[0091] In one embodiment, the matching module 202 is further configured to:
[0092] Matching each child node in the first menu tree with multiple child nodes and leaf nodes in the second menu tree to obtain target child nodes with modified levels, renamed, or deleted and unmodified child nodes; and
[0093] Match each leaf node in the first menu tree with multiple child nodes and leaf nodes in the second menu tree to obtain target leaf nodes with modified levels, renamed, or deleted, as well as unmodified leaf nodes;
[0094] According to the target child node, the unmodified child node, the target leaf node and the unmodified leaf node, a newly added target child node and a newly added target leaf node are determined from a plurality of child nodes and a plurality of leaf nodes in the second menu tree.
[0095] In one embodiment, the matching module 202 is further configured to:
[0096] Obtaining a first permission name and a first identification number of each child node in the first menu tree, and obtaining a second permission name and a second identification number of a plurality of child nodes and leaf nodes in the second menu tree;
[0097] Matching the first identification number of each subnode in the first menu tree with a plurality of second identification numbers in the second menu tree to determine a target identification number from each first identification number, the target identification number matching the second identification number;
[0098] The first permission name corresponding to the target identification number is compared with the second permission name, and each sub-node corresponding to the target identification number that is inconsistent with the comparison is determined as a target sub-node for renaming.
[0099] In one embodiment, the recombinant module 203 is further configured to:
[0100] Adding a newly added target child node and a target leaf node to the first menu tree to obtain a first desired sub-menu tree;
[0101] Based on the target child node and the target leaf node of the modified hierarchy, the corresponding nodes in the first desired sub-menu tree are hierarchically modified to obtain a second desired sub-menu tree;
[0102] Based on the renamed target child node and the target leaf node, renaming the corresponding nodes in the second desired sub-menu tree to obtain a third desired sub-menu tree;
[0103] Based on the target child node and the target leaf node to be deleted, a deletion operation is performed on the corresponding nodes in the third desired sub-menu tree to obtain the third menu tree.
[0104] In one embodiment, Figure 6 As shown, the role authority configuration device 200 further includes a parsing module 204, and the parsing module 204 is further used for:
[0105] Analyze whether there are any missing leaf nodes in the first role permission tree;
[0106] When there are missing leaf nodes in the first role permission tree, the child nodes corresponding to the missing leaf nodes are cleared.
[0107] In one embodiment, the matching module 202 is further configured to:
[0108] Obtaining a first personalized permission tree, where the first personalized permission tree is used to represent the original permissions of the set character before the first menu tree is reconstructed, and the first personalized permission tree includes some child nodes and some leaf nodes in the first role permission tree;
[0109] According to the leaf nodes in the first personalized permission tree, the third menu tree is matched from bottom to top to obtain a second personalized permission tree; the second personalized permission tree is used to represent the target permissions of the set character after the first menu tree is reconstructed, and the second personalized permission tree includes some child nodes and some leaf nodes in the third menu tree.
[0110] It should be noted that technical personnel in the relevant field can clearly understand that for the convenience and conciseness of description, the specific working process of the above-described device and each module and unit can refer to the corresponding process in the aforementioned role authority configuration method embodiment, and will not be repeated here.
[0111] The apparatus provided in the above embodiment may be implemented in the form of a computer program. The computer program may be Figure 7 Runs on the computer device shown.
[0112] See also Figure 7 , Figure 7 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application.
[0113] like Figure 7 As shown, the computer device includes a processor, a memory and a network interface connected via a system bus, wherein the memory may include a storage medium and an internal memory, and the storage medium may be non-volatile or volatile.
[0114] The storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any role authority configuration method.
[0115] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0116] The internal memory provides an environment for the operation of the computer program in the storage medium. When the computer program is executed by the processor, the processor can execute any role authority configuration method.
[0117] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 7The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0118] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0119] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0120] Acquire a first menu tree and a second menu tree; wherein the first menu tree is the original menu tree before reconstruction, and the second menu tree is the desired menu tree after reconstruction;
[0121] Matching the first menu tree with the second menu tree to identify a target child node and a target leaf node where modifications are made;
[0122] Based on the target child node and the target leaf node, the first menu tree is reorganized to obtain a third menu tree;
[0123] Obtaining a first role permission tree, where the first role permission tree is used to represent the original permissions of the set role before the first menu tree is reconstructed, and the first role permission tree includes some child nodes and some leaf nodes in the first menu tree;
[0124] According to the leaf nodes in the first role permission tree, the third menu tree is matched from bottom to top to obtain a second role permission tree; the second role permission tree is used to represent the target permissions of the set role after the first menu tree is reconstructed, and the second role permission tree includes some child nodes and some leaf nodes in the third menu tree.
[0125] In one embodiment, when the processor implements matching the first menu tree with the second menu tree to identify the target child node and the target leaf node where the modification exists, the processor is used to implement:
[0126] Matching the first menu tree with the plurality of child nodes and leaf nodes in the second menu tree to obtain a matching result;
[0127] According to the matching result, a newly added, modified, renamed, or deleted child node is obtained as the target child node, and a newly added, modified, renamed, or deleted leaf node is obtained according to the matching result as the target leaf node.
[0128] In one embodiment, when the processor implements matching the first menu tree with the second menu tree to identify the target child node and the target leaf node where the modification exists, the processor is used to implement:
[0129] Matching each child node in the first menu tree with multiple child nodes and leaf nodes in the second menu tree to obtain target child nodes with modified levels, renamed, or deleted and unmodified child nodes; and
[0130] Match each leaf node in the first menu tree with multiple child nodes and leaf nodes in the second menu tree to obtain target leaf nodes with modified levels, renamed, or deleted, as well as unmodified leaf nodes;
[0131] According to the target child node, the unmodified child node, the target leaf node and the unmodified leaf node, a newly added target child node and a newly added target leaf node are determined from a plurality of child nodes and a plurality of leaf nodes in the second menu tree.
[0132] In one embodiment, when matching each child node in the first menu tree with multiple child nodes and leaf nodes in the second menu tree to obtain a target child node to be renamed, the processor is used to implement:
[0133] Obtaining a first permission name and a first identification number of each child node in the first menu tree, and obtaining a second permission name and a second identification number of a plurality of child nodes and leaf nodes in the second menu tree;
[0134] Matching the first identification number of each subnode in the first menu tree with a plurality of second identification numbers in the second menu tree to determine a target identification number from each first identification number, the target identification number matching the second identification number;
[0135] The first permission name corresponding to the target identification number is compared with the second permission name, and each sub-node corresponding to the target identification number that is inconsistent with the comparison is determined as a target sub-node for renaming.
[0136] In one embodiment, when the processor implements the step of reorganizing the first menu tree based on the target child node and the target leaf node to obtain the third menu tree, the processor is configured to implement:
[0137] Adding a newly added target child node and a target leaf node to the first menu tree to obtain a first desired sub-menu tree;
[0138] Based on the target child node and the target leaf node of the modified hierarchy, the corresponding nodes in the first desired sub-menu tree are hierarchically modified to obtain a second desired sub-menu tree;
[0139] Based on the renamed target child node and the target leaf node, renaming the corresponding nodes in the second desired sub-menu tree to obtain a third desired sub-menu tree;
[0140] Based on the target child node and the target leaf node to be deleted, a deletion operation is performed on the corresponding nodes in the third desired sub-menu tree to obtain the third menu tree.
[0141] In one embodiment, after obtaining the first role permission tree, the processor is further configured to:
[0142] Analyze whether there are any missing leaf nodes in the first role permission tree;
[0143] When there are missing leaf nodes in the first role permission tree, the child nodes corresponding to the missing leaf nodes are cleared.
[0144] In one embodiment, the processor is further configured to implement:
[0145] Obtaining a first personalized permission tree, where the first personalized permission tree is used to represent the original permissions of the set character before the first menu tree is reconstructed, and the first personalized permission tree includes some child nodes and some leaf nodes in the first role permission tree;
[0146] According to the leaf nodes in the first personalized permission tree, the third menu tree is matched from bottom to top to obtain a second personalized permission tree; the second personalized permission tree is used to represent the target permissions of the set character after the first menu tree is reconstructed, and the second personalized permission tree includes some child nodes and some leaf nodes in the third menu tree.
[0147] It should be noted that technical personnel in the relevant field can clearly understand that for the convenience and brevity of description, the specific working process of the computer device described above can refer to the corresponding process in the aforementioned role authority configuration method embodiment, and will not be repeated here.
[0148] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0149] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the various embodiments of the role authority configuration method of the present application.
[0150] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.
[0151] Furthermore, the computer-usable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of blockchain nodes, etc. The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods, each of which contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain may include the underlying blockchain platform, the platform product service layer, and the application service layer.
[0152] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0153] It should also be understood that the term "and / or" used in the specification of this application and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.
[0154] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A role authority configuration method, characterized in that: include: Acquire a first menu tree and a second menu tree; wherein the first menu tree is the original menu tree before reconstruction, and the second menu tree is the desired menu tree after reconstruction; Matching the first menu tree with the second menu tree to identify a target child node and a target leaf node where modifications are made; Based on the target child node and the target leaf node, the first menu tree is reorganized to obtain a third menu tree; Obtaining a first role permission tree, where the first role permission tree is used to represent the original permissions of the set role before the first menu tree is reconstructed, and the first role permission tree includes some child nodes and some leaf nodes in the first menu tree; According to the leaf nodes in the first role permission tree, the third menu tree is matched from bottom to top to obtain a second role permission tree; the second role permission tree is used to represent the target permissions of the set role after the first menu tree is reconstructed, and the second role permission tree includes some child nodes and some leaf nodes in the third menu tree.
2. The role authority configuration method according to claim 1, characterized in that: The matching of the first menu tree with the second menu tree to identify the target child node and the target leaf node where the modification exists includes: Matching the first menu tree with the plurality of child nodes and leaf nodes in the second menu tree to obtain a matching result; According to the matching result, a newly added, modified, renamed, or deleted child node is obtained as the target child node, and a newly added, modified, renamed, or deleted leaf node is obtained according to the matching result as the target leaf node.
3. The role authority configuration method according to claim 1, characterized in that: The matching of the first menu tree with the second menu tree to identify the target child node and the target leaf node where the modification exists includes: Matching each child node in the first menu tree with multiple child nodes and leaf nodes in the second menu tree to obtain target child nodes with modified levels, renamed, or deleted and unmodified child nodes; and Match each leaf node in the first menu tree with multiple child nodes and leaf nodes in the second menu tree to obtain target leaf nodes with modified levels, renamed, or deleted, as well as unmodified leaf nodes; According to the target child node, the unmodified child node, the target leaf node and the unmodified leaf node, a newly added target child node and a newly added target leaf node are determined from a plurality of child nodes and a plurality of leaf nodes in the second menu tree.
4. The role authority configuration method as claimed in claim 3, characterized in that: Matching each child node in the first menu tree with multiple child nodes and leaf nodes in the second menu tree to obtain a renamed target child node includes: Obtaining a first permission name and a first identification number of each child node in the first menu tree, and obtaining a second permission name and a second identification number of a plurality of child nodes and leaf nodes in the second menu tree; Matching the first identification number of each subnode in the first menu tree with a plurality of second identification numbers in the second menu tree to determine a target identification number from each first identification number, the target identification number matching the second identification number; The first permission name corresponding to the target identification number is compared with the second permission name, and each sub-node corresponding to the target identification number that is inconsistent with the comparison is determined as a target sub-node for renaming.
5. The role authority configuration method according to any one of claims 1 to 4, characterized in that: The step of reorganizing the first menu tree based on the target child node and the target leaf node to obtain a third menu tree includes: Adding a newly added target child node and a target leaf node to the first menu tree to obtain a first desired sub-menu tree; Based on the target child node and the target leaf node of the modified hierarchy, the corresponding nodes in the first desired sub-menu tree are hierarchically modified to obtain a second desired sub-menu tree; Based on the renamed target child node and the target leaf node, renaming the corresponding nodes in the second desired sub-menu tree to obtain a third desired sub-menu tree; Based on the target child node and the target leaf node to be deleted, a deletion operation is performed on the corresponding nodes in the third desired sub-menu tree to obtain the third menu tree.
6. The role authority configuration method according to any one of claims 1 to 4, characterized in that: After obtaining the first role permission tree, the method further includes: Analyze whether there are any missing leaf nodes in the first role permission tree; When there are missing leaf nodes in the first role permission tree, the child nodes corresponding to the missing leaf nodes are cleared.
7. The role authority configuration method according to any one of claims 1 to 4, characterized in that: The method further comprises: Obtaining a first personalized permission tree, where the first personalized permission tree is used to represent the original permissions of the set character before the first menu tree is reconstructed, and the first personalized permission tree includes some child nodes and some leaf nodes in the first role permission tree; According to the leaf nodes in the first personalized permission tree, the third menu tree is matched from bottom to top to obtain a second personalized permission tree; the second personalized permission tree is used to represent the target permissions of the set character after the first menu tree is reconstructed, and the second personalized permission tree includes some child nodes and some leaf nodes in the third menu tree.
8. A role authority configuration device, characterized in that: The role authority configuration device comprises: An acquisition module, used for acquiring a first menu tree and a second menu tree; wherein the first menu tree is an original menu tree before reconstruction, and the second menu tree is a desired menu tree after reconstruction; A matching module, used for matching the first menu tree with the second menu tree to identify a target child node and a target leaf node where modifications exist; A reorganization module, used for reorganizing the first menu tree based on the target child node and the target leaf node to obtain a third menu tree; The acquisition module is further used to acquire a first role permission tree, where the first role permission tree is used to represent the original permissions of the set role before the first menu tree is reconstructed, and the first role permission tree includes some child nodes and some leaf nodes in the first menu tree; The matching module is also used to match the third menu tree from bottom to top according to the leaf nodes in the first role permission tree to obtain a second role permission tree; the second role permission tree is used to represent the target permissions of the set role after the first menu tree is reconstructed, and the second role permission tree includes some child nodes and some leaf nodes in the third menu tree.
9. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the role authority configuration method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the role authority configuration method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Data permission adjustment method and device based on data storage system
CN111767525A
Directory display method and device, computer equipment and computer readable storage medium
CN112035478A
Authority management method and device
CN113505996A
Medical System and Authority Management Method Therefor
US20230021770A1
