Role permission updating method and device and electronic equipment

Through the role's permission tree linkage update mechanism, the problem of low efficiency of the role's permission update is solved, and the role's permission update efficiency is improved, ensuring the smooth progress of the role's permission update in the system.

CN119026097APending Publication Date: 2024-11-26HILLSTONE NETWORKS CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411124321.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

In the role-based access control model, when role permissions are updated, the permission update efficiency of affected roles is inefficient, and the existing technology has not effectively solved this problem.

Method used

After detecting that the system permissions of the role are updated, the role's permission tree is obtained, and the affected role's permission tree is updated according to the permission tree, so that it is within the updated permission scope. The linkage update mechanism of the permission tree is clear and Sequentially represent the permission relationship between system functional modules, improving data search and update speed.

Benefits of technology

It improves the efficiency of the role's permission update, realizes the linkage update of the role's permissions, solves the problem of low permission update efficiency, and ensures that the permission update of the role in the system is smooth.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119026097A_ABST
    Figure CN119026097A_ABST
Patent Text Reader

Abstract

The invention discloses a role permission updating method and device and electronic equipment. Relates to the technical field of Internet, and the method comprises the following steps: when it is detected that a system permission of a first role is updated, obtaining a permission tree after the system permission of the first role is updated, and obtaining a first permission tree which is used for representing permissions owned by the first role for each function module in a system; an authority tree to which a second role belongs is obtained, a second authority tree is obtained, and the second role is a role of which the system authority range is within the system authority range before the first role is updated; and updating the second permission tree according to the first permission tree, so that the system permission range after the second role is updated is within the system permission range after the first role is updated. According to the method and the device, the technical problem that the updating efficiency of the authority of the role limited by the authority of the role is low when the authority of a certain role in a system is updated in the related technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet technology, and in particular to a method, device and electronic device for updating role permissions. Background Art

[0002] When developing any system, we will inevitably face the problem of permission control, that is, controlling which users can perform which operations. In the field of permission control, there are many mature models, such as discretionary access control (DAC), mandatory access control (MAC), attribute-based access control (ABAC), role-based access control (RBAC), among which the most common is the role-based access control model.

[0003] The role-based permission control model has the concept of role hierarchy. There is an association relationship between roles at different levels. When the permissions of a certain role are updated, the permissions of roles restricted by the permissions of this role may need to be updated synchronously. Currently, there is a problem of low update efficiency in related technologies.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present invention provide a method, device and electronic device for updating role permissions, so as to at least solve the technical problem that when the related art updates the permissions of a role in a system, the updating efficiency of the permissions of a role restricted by the role permissions is low.

[0006] According to one aspect of an embodiment of the present invention, a method for updating role permissions is provided, comprising: when a system permission update of a first role is detected, obtaining a permission tree after the system permission update of the first role, to obtain a first permission tree, wherein the first permission tree is used to characterize the permissions that the first role has for each functional module in the system; obtaining a permission tree to which a second role belongs, to obtain a second permission tree, wherein the second role is a role whose system permission range is within the system permission range before the first role is updated; and updating the second permission tree according to the first permission tree, so that the system permission range of the second role after the update is within the system permission range of the first role after the update.

[0007] Furthermore, the permission tree includes multiple layers of module nodes, and each module node has permission information, wherein the method for updating role permissions also includes: determining a first module node from a second permission tree, wherein the first module node is a module node for target permission information to be determined; determining permission information of the first module node in the first permission tree to obtain first permission information, and determining permission information of the first module node in the second permission tree to obtain second permission information; determining target permission information of the first module node in the second permission tree according to respective permission levels of the first permission information and the second permission information; and when the determined target permission information is different from the second permission information, updating the second permission tree according to the determined target permission information.

[0008] Furthermore, the method for updating role permissions also includes: after determining the target permission information of the first module node in the second permission tree, if there is a sub-module node in the first module node, determining the target permission information of the sub-module node of the first module node in the second permission tree according to the respective permission levels of the first permission information and the second permission information.

[0009] Furthermore, the method for updating role permissions also includes: if the permission level of the first permission information is higher than the permission level of the second permission information, or the first permission information is the same as the second permission information, then the second permission information is determined as the target permission information of the first module node; if the permission level of the first permission information is lower than the permission level of the second permission information, then the first permission information is determined as the target permission information of the first module node; if the permission level of the first permission information is the same as the permission level of the second permission information, and the first permission information is different from the second permission information, then the preset permission information is determined as the target permission information of the first module node.

[0010] Further, when the permission information of the module node is non-empty, the sub-module node of the module node inherits the permission information of the module node, wherein the method for updating role permissions also includes: when the permission level of the first permission information is the highest permission level, determining that the permission information of the sub-module node of the first module node in the second permission tree is the target permission information of the sub-module node; when the permission level of the second permission information is the highest permission level, determining that the permission information of the sub-module node of the first module node in the first permission tree is the target permission information of the sub-module node; when the permission level of the first permission information and the permission level of the second permission information are not the highest permission level, determining the sub-module node directly connected to the first module node in the second permission tree as the updated first module node; determining the target permission information of the updated first module node in the second permission tree, and when the updated first module node has a sub-module node, determining the target permission information of the sub-module node of the updated first module node in the second permission tree.

[0011] Furthermore, in the permission tree, for each module node, if the permission information of the module node is non-empty and there is a target module node, the target module node is in a hidden state in the permission tree, wherein the target module node is a sub-module node directly connected to the module node and has the same permission information as the module node, wherein the method for updating role permissions also includes: when the permission information of the first module node in the second permission tree is non-empty, restoring the display of the target module node corresponding to the first module node in the second permission tree to obtain a processed second permission tree; and determining the sub-module node directly connected to the first module node in the processed second permission tree as the updated first module node.

[0012] Furthermore, the method for updating role permissions also includes: when the permission information of the first module node in the first permission tree is non-empty, restoring and displaying the target module node corresponding to the first module node in the first permission tree to obtain a processed first permission tree; and determining the target permission information of the updated first module node in the second permission tree based on the processed first permission tree.

[0013] Furthermore, the method for updating role permissions also includes: determining whether the processed first permission tree includes an updated first module node; if the processed first permission tree includes the updated first module node, determining target permission information of the updated first module node in the second permission tree based on the processed first permission tree.

[0014] Furthermore, the method for updating role permissions also includes: obtaining a role tree, wherein the role tree includes multiple layers of role nodes, and in any two adjacent layers of role nodes, the system permissions corresponding to the upper role nodes are higher than the system permissions corresponding to the lower role nodes; determining from the role tree the lower role node directly connected to the role node of the first role, to obtain the role node of the second role; and obtaining the second permission tree based on the permission tree corresponding to the role node of the second role.

[0015] Furthermore, the method for updating role permissions also includes: after updating the second permission tree according to the first permission tree, obtaining the permission tree of the third role to obtain a third permission tree, wherein the third role is a role whose system permission range is within the system permission range before the second role is updated; updating the third permission tree according to the updated second permission tree so that the updated system permission range of the third role is within the updated system permission range of the second role.

[0016] Furthermore, the method for updating role permissions also includes: after updating the second permission tree according to the first permission tree, upon receiving an access request from the user, determining the permission tree of the role to which the user belongs to obtain a target permission tree; determining the permission chain corresponding to the interface accessed by the access request, wherein the permission chain represents the permissions required to access the interface, the permission chain includes multiple module nodes with a hierarchical relationship and permission information corresponding to the last-level module node; determining the permission information of the top-level module node in the permission chain that has not been matched in the target permission tree as the current permission information, and judging whether the current permission information matches the reference permission information, wherein the reference permission information refers to the permission information in the permission chain; and allowing the access request to access the interface if the current permission information matches the reference permission information.

[0017] Furthermore, the method for updating role permissions also includes: after determining whether the current permission information matches the reference permission information, if the current permission information does not match the reference permission information, redetermining the top-level module node that has not been matched from the permission chain to redetermine the current permission information; repeating the step of determining whether the updated current permission information matches the reference permission information until the updated current permission information matches the reference permission information, allowing access to the request access interface, or prohibiting access to the request access interface until there are no module nodes in the permission chain that have not been matched.

[0018] According to another aspect of an embodiment of the present invention, a device for updating role permissions is also provided, including: a first acquisition module, used to obtain a permission tree after the system permissions of the first role are updated when an update of the system permissions of the first role is detected, and obtain a first permission tree, wherein the first permission tree is used to characterize the permissions that the first role has for each functional module in the system; a second acquisition module, used to obtain a permission tree to which a second role belongs, and obtain a second permission tree, wherein the second role is a role whose system permission range is within the system permission range before the first role is updated; a first update module, used to update the second permission tree according to the first permission tree, so that the updated system permission range of the second role is within the updated system permission range of the first role.

[0019] According to another aspect of an embodiment of the present invention, an electronic device is also provided, which includes one or more processors; a memory for storing one or more programs, so that when the one or more programs are executed by the one or more processors, the one or more processors are implemented to run the programs, wherein the programs are configured to execute the above-mentioned method for updating role permissions at runtime.

[0020] In an embodiment of the present invention, a method of linking and updating the permissions of roles based on a permission tree is adopted. When the system permission update of the first role is detected, the permission tree after the system permission update of the first role is obtained to obtain the first permission tree, and then the permission tree to which the second role belongs is obtained to obtain the second permission tree, so that the second permission tree is updated according to the first permission tree, so that the updated system permission range of the second role is within the updated system permission range of the first role. Among them, the first permission tree is used to represent the permissions that the first role has for each functional module in the system, and the second role is a role whose system permission range is within the system permission range before the first role is updated.

[0021] In the above process, by acquiring the first permission tree corresponding to the first role and the second permission tree corresponding to the second role when the system permission of the first role is detected to be updated, the system permissions of the role and the roles restricted by the permissions of the role are effectively acquired when the permissions of a certain role in the system are updated. Furthermore, by using the permission tree to represent the system permissions of the first role and the second role, the system permissions are represented by a tree data structure, so that the permission relationship between the system function modules can be clearly and orderly represented, the data search and update speed can be improved, and then when the second permission tree is updated according to the first permission tree, the permission update efficiency can be effectively improved.

[0022] It can be seen that the solution provided by the present application achieves the purpose of linkage update of role permissions based on the permission tree, thereby realizing the technical effect of improving the efficiency of permission update, and further solving the technical problem of low efficiency in updating the permissions of roles restricted by the permissions of a role in the system when the related technology updates the permissions of the role. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0024] Figure 1 is a schematic diagram of an optional method for updating role permissions according to an embodiment of the present invention;

[0025] Figure 2 is a schematic diagram of an optional module tree according to an embodiment of the present invention;

[0026] Figure 3 is a schematic diagram of an optional permission tree according to an embodiment of the present invention;

[0027] Figure 4 is a schematic diagram of an optional role tree according to an embodiment of the present invention;

[0028] Figure 5 is a schematic diagram of an optional determination of target authority information of a first module node according to an embodiment of the present invention;

[0029] Figure 6 is a schematic diagram of an optional method for determining target permission information of a first module node and a submodule node according to an embodiment of the present invention Figure 1 ;

[0030] Figure 7 is a schematic diagram of an optional method for determining target permission information of a first module node and a submodule node according to an embodiment of the present invention Figure 2 ;

[0031] Figure 8 is a schematic diagram of an optional equivalent permission tree according to an embodiment of the present invention Figure 1 ;

[0032] Fig. 9 is a schematic diagram of an optional equivalent permission tree according to an embodiment of the present invention Figure 2 ;

[0033] Fig.10 is a schematic diagram of an optional method for determining target permission information of a first module node and a submodule node according to an embodiment of the present invention Figure 3 ;

[0034] Fig.11 is a schematic diagram of an optional method for determining target permission information of a first module node and a submodule node according to an embodiment of the present invention Figure 4 ;

[0035] Fig.12 is a schematic diagram of an optional method for determining target permission information of a first module node and a submodule node according to an embodiment of the present invention Figure 5 ;

[0036] Fig.13 is a schematic diagram of an optional method for determining target permission information of a first module node and a submodule node according to an embodiment of the present invention Figure 6 ;

[0037] Fig.14 is a schematic diagram of permission linkage of an optional role tree according to an embodiment of the present invention;

[0038] Fig.15 is a schematic diagram of an optional permission chain according to an embodiment of the present invention Figure 1 ;

[0039] Fig.16 is a schematic diagram of an optional permission chain according to an embodiment of the present invention Figure 2 ;

[0040] Fig.17 is a schematic diagram of an optional device for updating role permissions according to an embodiment of the present invention;

[0041] Fig.18 is a schematic diagram of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0042] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0043] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0044] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards in the relevant regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0045] Example 1

[0046] According to an embodiment of the present invention, an embodiment of a method for updating role permissions is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0047] Figure 1 is a schematic diagram of an optional method for updating role permissions according to an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:

[0048] Step S101, when it is detected that the system permission of the first role is updated, the permission tree after the system permission of the first role is updated is obtained to obtain a first permission tree, wherein the first permission tree is used to represent the permissions that the first role has for each functional module in the system.

[0049] Optionally, electronic devices, application systems, servers and other devices can be used as the execution subject of the present application. In this embodiment, the target processing system is used as the execution subject to execute the above-mentioned role authority update method. The target processing system can be a system in a firewall, a system where the server is located, or other systems with authority control requirements.

[0050] In some embodiments, a role is bound to a set of permissions, and a user is bound to one or more roles. The permissions of the role to which the user belongs determine the user's access rights to the system. For example, in a firewall scenario, the role can be a system administrator, security analyst, operation and maintenance personnel, project leader, etc. In a financial scenario, the role can be a customer service representative, teller, auditor, accountant, etc.

[0051] In some embodiments, the unit of authority division is called a "module", each module can be divided into several "sub-modules", and a module may not have a "sub-module". All modules in the system form a hierarchical structure, called a "module tree". There is a special module in the module tree called a "root module", which is located at the top of the module hierarchy and represents all modules in the system. The aforementioned "module" is also the aforementioned "functional module". For example, a module represents a function in the system. In the firewall scenario, a module can represent the policy configuration function in the firewall system. In the financial scenario, a module can represent the transaction information storage function in the financial system. Figure 2 is a schematic diagram of an optional module tree according to an embodiment of the present invention, such as Figure 2 As shown, Figure 2 The top level is the "root module". In this embodiment, the symbol " / " is used to represent the name of the "root module". Module A and module B are submodules of the "root module". Module C and module D are submodules of module A. Module E is a submodule of module B. Modules C, D, and E have no submodules.

[0052] Optionally, in this embodiment, a permission tree is used to represent role permissions. The permission tree is similar to the module tree and is also a tree structure. Each role in the system is assigned a permission tree, which represents all permissions possessed by the role. Each node in the permission tree (i.e., module node) corresponds to a unique node in the module tree, that is, to a module in the system. The level of each node in the permission tree is consistent with the level of the corresponding node in the module tree. For example, Figure 2 If module C in the module tree is a submodule of module A, then in the permission tree C must also be a child node (i.e., a submodule node) of A. When a user accesses a certain function, the system can determine whether the user has the permission to access the specified function based on the permission tree, thereby achieving the purpose of access control.

[0053] In some embodiments, the set of modules corresponding to all nodes in the permission tree is a subset of the set of modules corresponding to all nodes in the module tree or the set itself. In other words, the modules corresponding to all nodes in the permission tree are part or all of all modules in the module tree. Each node in the permission tree not only corresponds to a module, but also comes with permission information. The permission information of the node represents the permissions that the role has for the module corresponding to the node.

[0054] Optionally, the permission information can be non-empty or empty. In some embodiments, when the permission information of the module node is non-empty, the permission information can be read-only, write-only, or read-write. In some embodiments, when the permission information of the module node is non-empty, the permission information can be read-only or read-write. In some embodiments, when the permission information of the module node is non-empty, the permission information can be read-only, execute-only, or readable and executable. In other embodiments, the content of the permission information can also be freely set according to the needs of the actual application.

[0055] Optionally, when the permission information of a node is non-empty, it means that the role not only has the corresponding permission of the module corresponding to the node, but also has the corresponding permission of all sub-modules of the module corresponding to the node. In other words, when the permission information of a node is non-empty, the permission information of the sub-node corresponding to the node inherits the permission information of the node. For example, a node has read-only permission, which means that the role has read-only permission of the module corresponding to the node and all sub-modules of the module corresponding to the node. For another example, a node has read-write permission, which means that the role has read-write permission of the module corresponding to the node and all sub-modules of the module corresponding to the node. When the permission information of a node is empty, it means that for any non-empty permission information, all sub-modules of the module corresponding to the node do not fully have the permission information. For example, if the permission information of a node is empty, not all sub-modules under the module corresponding to the node have read-only permission, not all sub-modules have write-only permission, and not all sub-modules have read-write permission. If there is no child node under a node in the permission tree, the permission information of the node must be non-empty.

[0056] If a module in the module tree does not appear in the permission tree, there are two possibilities. 1: If the corresponding node of the parent module of the module appears in the permission tree and the permission information is not empty, the role has the same permissions for the module and all its submodules as the parent module; 2: If all the corresponding nodes of the parent modules of the module do not appear in the permission tree, or appear in the permission tree and the permission information is empty, the role does not have any permissions for the module and all its submodules.

[0057] In this embodiment, the permission information is empty or non-empty, and when the permission information of the module node is non-empty, the permission information can be read-only, write-only, or read-write. Figure 3 is a schematic diagram of an optional permission tree according to an embodiment of the present invention, Figure 3 The permission tree in Figure 2 Corresponding to the module tree in, Figure 3 Each node is divided into two parts. The upper part is used to represent the module, and the lower part is used to represent the node's permission information. "R" represents read-only permission, "RW" represents read-write permission, and "W" represents write-only permission. Figure 3In the permission tree, the permission information of the node “ / ” (i.e. the root node) is empty, which means that the role corresponding to the permission tree may only have the permission to some sub-modules (module A) in the root module, or the permissions of all sub-modules of the root module are not exactly the same. The node where module A is located has read-only permission, which means that the role has read-only permission to all sub-modules of module A (module C, module D). The node where module C is located has read-write permission, which means that the role has read-write permission to module C. Although module D is not in the permission tree, because its parent module A is in the permission tree and module A has read-only permission, the role has read-only permission to module D. Module B and module E are not in the permission tree, and their parent modules do not have permission information, so modules B and E have no permissions. So Figure 3 The role permissions represented by the permission tree are: read-only permissions for all submodules of module A, read-write permissions for module C, and no permissions for modules B and E.

[0058] In some embodiments, the user can update the system permissions of the first role, so that when the target processing system detects that the system permissions of the first role have been updated, it obtains the permission tree after the system permissions of the first role have been updated, and obtains the first permission tree. Optionally, the aforementioned user may refer to an administrator using the target processing system. The system permission range corresponding to the first permission tree is the system permission range of the first role after the update.

[0059] In some embodiments, the target processing system may also obtain the updated permission tree of the first role's system permissions to obtain the first permission tree when detecting that the first role's system permissions are updated and the system permission range before the update is not within the updated system permission range.

[0060] Optionally, in the target processing system, permission levels corresponding to various permission information are preset. The target processing system can determine that the system permission range has not increased when it detects that the permission level of the updated permission information in the permission tree of the first role has not increased, and determine that the system permission range has increased when it detects that the permission level of all updated permission information points in the permission tree of the first role has increased.

[0061] In some embodiments, if the permission information is empty, read and write, read and write, the permission levels between the permission information can be expressed as follows: read and write > read = write > empty, that is, the read and write permission level is the highest, the empty level is the lowest, and the read and write levels are the same.

[0062] Step S102, obtaining the permission tree to which the second role belongs, and obtaining a second permission tree, wherein the second role is a role whose system permission range is within the system permission range before the first role is updated.

[0063] Optionally, there are multiple roles in the target processing system, and there may be associations between the multiple roles. In this embodiment, some roles (such as the second role) are set to have their system authority ranges within the system authority ranges of other roles (such as the first role), that is, the system authority range of the second role is within the system authority range of the first role before the update.

[0064] Since after the system permissions of the first role are updated, the system permission range of the second role may no longer be smaller than the system permission range of the first role, in order to meet the above-mentioned conditions of the system, it is necessary to determine the second role and obtain the second permission tree, so as to update the second permission tree according to the first permission tree, so that the updated system permission range of the second role is smaller than the updated system permission range of the first role.

[0065] In some embodiments, the target processing system may preset an association relationship between these roles, that is, the target processing system may preset an association relationship between the first role and the second role, so that when a system permission update of the first role is detected, the second role is determined, and the permission tree to which the second role belongs is obtained to obtain the second permission tree.

[0066] In some embodiments, an association relationship between roles in the system is established based on a role tree, so as to determine a second role based on the role tree. Optionally, there is only one top-level role in the target processing system, and the role has authority over all functions of the system. Except for the top-level role, other roles have and only have one direct superior role, and the top-level role has no direct superior. A corresponding role node is determined according to each role, and each role node and its direct superior are connected with an edge, so that all role nodes form a tree structure with the top being the top-level role, i.e., a role tree. Starting from a certain role node in the role tree, a chain is formed by walking upward along the edge connecting the role nodes. The role node above the role node in this chain is called the "superior role node" of the role node, and the role corresponding to the role node above the role node in this chain is called the "superior role" of the role corresponding to the role node. Figure 4 FIG. 1 is a schematic diagram of an optional role tree according to an embodiment of the present invention. Figure 4 As shown, in the role tree, role A (i.e. Figure 4 The role corresponding to the A role node in the figure is the top-level role. Roles B, C, D, E, F, and G all have an arrow pointing to another role. The role pointed to by the arrow is the direct superior of the role. For example, the direct superior of role B is role A, and the direct superior of role F is role C. Starting from role G, a chain is formed along the direction of the arrow. There are four roles G, D, B, and A on the chain. Among them, D, B, and A are located above role G, so roles D, B, and A are the superior roles of role G.

[0067] In some embodiments, the permissions of any role in the role tree must be within the permissions of its immediate superior role. Figure 4 For example, the permissions of role B must be within the permissions of role A, that is, when the first role is role A, the second role is role B. Similarly, the permissions of role D must be within the permissions of role B, that is, when the first role is role B, the second role is role D. That is, in the role tree of this embodiment, as the role level increases, the permissions of the roles decrease. Therefore, by setting the permissions of a certain role, the permissions of all the roles under the role can be limited, because the permissions of all the lower roles must not exceed the permissions of the role.

[0068] In some embodiments, the second role can be a direct subordinate role of the first role in the role tree, or a non-direct subordinate role of the first role. Figure 4 Taking the roles in as an example, when the first role is role A, the second role can be role B, or role B, role D, role E, and role G.

[0069] Step S103, updating the second permission tree according to the first permission tree so that the updated system permission range of the second role is within the updated system permission range of the first role.

[0070] Optionally, after obtaining the first permission tree and the second permission tree, the target processing system may compare the first permission tree and the second permission tree to determine the permission information in the second permission tree that is outside the system permission scope of the first permission tree, and update the portion of permission information so that the system permission scope of the second role is smaller than the system permission scope of the updated first role.

[0071] Optionally, if the second permission tree does not contain permission information outside the system permission range of the first permission tree, there is no need to update the second permission tree.

[0072] Optionally, the above process of modifying the permissions of associated roles based on the permission changes of a certain role can be called role permission linkage, and because the permissions of the roles are represented by a permission tree, the permission linkage between roles is actually the linkage of two permission trees. When the permission tree of a certain role changes, the system permissions of the certain role change.

[0073] Based on the scheme defined by the above steps S101 to S103, it can be known that in an embodiment of the present invention, a method of linking and updating the permissions of roles based on a permission tree is adopted. When the system permission update of the first role is detected, the permission tree after the system permission update of the first role is obtained to obtain the first permission tree, and then the permission tree to which the second role belongs is obtained to obtain the second permission tree, so that the second permission tree is updated according to the first permission tree, so that the updated system permission range of the second role is within the updated system permission range of the first role. Among them, the first permission tree is used to represent the permissions that the first role has for each functional module in the system, and the second role is a role whose system permission range is within the system permission range before the first role is updated.

[0074] It is easy to notice that in the above process, by acquiring the first permission tree corresponding to the first role and the second permission tree corresponding to the second role when the system permission of the first role is detected to be updated, the system permissions of the role and the roles restricted by the permissions of the role are effectively acquired when the permissions of a certain role in the system are updated. Furthermore, by using the permission tree to represent the system permissions of the first role and the second role, the system permissions are represented by a tree data structure, so that the permission relationship between the system function modules can be clearly and orderly represented, and the speed of data search and update can be improved, so that when the second permission tree is updated according to the first permission tree, the permission update efficiency can be effectively improved.

[0075] It can be seen that the solution provided by the present application achieves the purpose of linkage update of role permissions based on the permission tree, thereby realizing the technical effect of improving the efficiency of permission update, and further solving the technical problem of low efficiency in updating the permissions of roles restricted by the permissions of a role in the system when the related technology updates the permissions of the role.

[0076] In an optional embodiment, the permission tree includes multiple layers of module nodes, each module node has permission information, wherein, in the process of updating the second permission tree according to the first permission tree, the target processing system can determine the first module node from the second permission tree, and then determine the permission information of the first module node in the first permission tree to obtain the first permission information, and determine the permission information of the first module node in the second permission tree to obtain the second permission information, and then determine the target permission information of the first module node in the second permission tree according to the respective permission levels of the first permission information and the second permission information, so that when the determined target permission information is different from the second permission information, the second permission tree is updated according to the determined target permission information. Wherein, the first module node is the module node of the target permission information to be determined.

[0077] In some embodiments, the target processing system may determine the first module node from the second permission tree.

[0078] In some embodiments, in the process of determining the target permission information of the first module node in the second permission tree according to the respective permission levels of the first permission information and the second permission information, the target processing system compares the respective permission levels of the first permission information and the second permission information, thereby determining the target permission information of the first module node in the second permission tree according to the comparison result. For example, if the permission level of the first permission information is higher than the permission level of the second permission information, or the first permission information is the same as the second permission information, the second permission information is determined as the target permission information of the first module node, and if the permission level of the first permission information is lower than the permission level of the second permission information, the first permission information is determined as the target permission information of the first module node.

[0079] In some embodiments, the target processing system may traverse the second permission tree, determine each module node in the second permission tree as a first module node, and then determine target permission information of each first module node.

[0080] In some embodiments, the target processing system may traverse the second permission tree in order from top to bottom, determine a module node currently traversed on the second permission tree as a first module node, and determine target permission information of the first module node.

[0081] In some embodiments, the target processing system may determine the top-level node in the second permission tree as the first module node, and then after determining the first module node, determine the target permission information of the first module node based on the respective permission levels of the first permission information and the second permission information, and determine the target permission information of the sub-module nodes of the first module node to improve the efficiency of determining the target permission information.

[0082] Optionally, when the first module node does not exist in the second permission tree, and when the determined target permission information is different from the second permission information, the second permission tree is updated according to the determined target permission information. Wherein, when comparing whether the target permission information is the same as the second permission information, the target permission information of the same module node in the second permission tree is compared with the second permission information. The process of updating the second permission tree according to the target permission information can be understood as replacing the permission information of the module node to which the target permission information belongs in the second permission tree with the target permission information. By updating the second permission tree when the first module node does not exist in the first permission tree, it is avoided that when the second permission tree is updated in advance, the process of determining the subsequent target permission information of the first module node will be affected, thereby improving the accuracy of the updated second permission tree.

[0083] In some embodiments, in the process of updating the second permission tree according to the determined target permission information, the second permission tree is updated according to the determined target permission information in the order of the module nodes corresponding to the target permission information from the lower level to the upper level. That is, the permission information of the module nodes at the relatively lower level in the second permission tree is updated first, and then the permission information of the module nodes at the relatively upper level in the second permission tree is updated.

[0084] Optionally, when the first module node does not exist in the second permission tree and each determined target permission information is the same as the second permission information, the target processing system does not update the second permission tree.

[0085] It should be noted that by determining the target permission information corresponding to the module node based on the permission level of the module node in the first permission tree and the second permission tree, on the one hand, the accuracy of the determined target permission information is improved, and on the other hand, the omission of the module node in the second permission tree is avoided, that is, the omission of each functional module that the role has permission to is avoided, thereby effectively improving the efficiency of permission updating.

[0086] In an optional embodiment, after determining the target permission information of the first module node in the second permission tree, the target processing system may, if a sub-module node exists in the first module node, determine the target permission information of the sub-module node of the first module node in the second permission tree based on the respective permission levels of the first permission information and the second permission information.

[0087] In some embodiments, the first module node determined by the target processing system from the second permission tree is a root node.

[0088] Optionally, after determining the target permission information of the first module node in the second permission tree, the target processing system may determine whether there is a sub-module node under the first module node.

[0089] For example, the first module node to be determined whether there is a sub-module node can be used as the current first module node. If the current first module node does not have a sub-module node, the step of determining whether the target permission information of the current first module node is the same as the second permission information of the current first module node is performed until the target permission information is determined for other first module nodes except the current first module node.

[0090] If the first module node has a submodule node, the target permission information of the submodule node of the first module node in the second permission tree may be determined according to the respective permission levels of the first permission information and the second permission information.

[0091] For example, since the sub-module nodes of the module node in the permission tree inherit the permission information of the module node when the permission information of the module node is non-empty, the target processing system can determine that the permission information of the sub-module node of the first module node in the second permission tree is the target permission information of the sub-module node when the permission level of the first permission information is the highest permission level, and determine that the permission information of the sub-module node of the first module node in the first permission tree is the target permission information of the sub-module node when the permission level of the second permission information is the highest permission level, thereby realizing the rapid determination of the target permission information of the sub-module node of the first module node.

[0092] It should be noted that, through the above process, the target permission information of the child module node is determined based on the permission information of the parent module node, which avoids the need to determine the permission information corresponding to each child module node in the first permission tree and the second permission tree respectively when each module node in the second permission tree is used as the first module node, thereby further improving the efficiency of determining the target permission information.

[0093] In an optional embodiment, in the process of determining the target permission information of the first module node in the second permission tree based on the respective permission levels of the first permission information and the second permission information, the target processing system may determine the second permission information as the target permission information of the first module node if the permission level of the first permission information is higher than the permission level of the second permission information, or the first permission information is the same as the second permission information; determine the first permission information as the target permission information of the first module node if the permission level of the first permission information is lower than the permission level of the second permission information; and determine the preset permission information as the target permission information of the first module node if the permission level of the first permission information is the same as the permission level of the second permission information, and the first permission information is different from the second permission information.

[0094] In some embodiments, if the permission information is empty, read and write, read, write, the permission levels between the permission information can be expressed as follows: read and write > read = write > empty, that is, the read and write permission level is the highest, the empty permission level is the lowest, and the read and write permission levels are the same.

[0095] In this case, the above method of determining the target permission information of the first module node can be described as the following rules:

[0096] Rule 1: If the permission information of the vertices (i.e., the first module node) of the superior role (i.e., the first role) and the subordinate role (i.e., the second role) is the same, the permission information of the subordinate role vertex remains unchanged;

[0097] Rule 2: If the permission information of the vertex of the superior role is read-write, the permission information of the vertex of the subordinate role remains unchanged;

[0098] Rule 3: If the permission information of one of the upper role and lower role vertices is empty, the target permission information of the lower role vertex is empty;

[0099] Rule 4: If the permission information of the vertex of the superior role is read-only (or write-only), and the permission information of the vertex of the subordinate role is read-write, then the target permission information of the vertex of the subordinate role is read-only (or write-only).

[0100] Rule 5: If the permission information of the vertex of the superior role is read-only (or write-only), and the permission information of the vertex of the subordinate role is write-only (or read-only), then the target permission information of the vertex of the subordinate role is empty, that is, the empty permission is the preset permission information.

[0101] For example, Figure 5 is a schematic diagram of an optional method for determining target permission information of a first module node according to an embodiment of the present invention, Figure 5 FIG. 4 shows the process of determining the target permission information of the first module node according to the above rules in some cases.

[0102] It should be noted that, through the above method, it is ensured that the permission range of the target permission information can be effectively within the permission range of the first permission information, thereby improving the accuracy of the determined second permission information.

[0103] In an optional embodiment, when the permission information of the module node is non-empty, the sub-module node of the module node inherits the permission information of the module node, wherein, in the process of determining the target permission information of the sub-module node of the first module node in the second permission tree according to the respective permission levels of the first permission information and the second permission information, the target processing system can, when the permission level of the first permission information is the highest permission level, determine that the permission information of the sub-module node of the first module node in the second permission tree is the target permission information of the sub-module node, when the permission level of the second permission information is the highest permission level, determine that the permission information of the sub-module node of the first module node in the first permission tree is the target permission information of the sub-module node, when the permission level of the first permission information and the permission level of the second permission information are not the highest permission levels, determine the sub-module node directly connected to the first module node in the second permission tree as the updated first module node, determine the target permission information of the updated first module node in the second permission tree, and when the updated first module node has a sub-module node, determine the target permission information of the sub-module node of the updated first module node in the second permission tree.

[0104] Optionally, when the permission information of a node is non-empty, it means that the role not only has the corresponding permission of the module corresponding to the node, but also has the corresponding permission of all sub-modules of the module corresponding to the node. In other words, when the permission information of a node is non-empty, the permission information of the sub-node corresponding to the node inherits the permission information of the node. When the permission information of a node is empty, it means that for any non-empty permission information, all sub-modules of the module corresponding to the node do not fully possess the permission information.

[0105] In some embodiments, the permission level is the lowest when the permission information is empty.

[0106] In some embodiments, when the permission level of the first permission information is the highest permission level, based on the inheritance mechanism, it is determined that the permission levels of all sub-modules under the first module node in the first permission tree are also the highest permission level. Therefore, the permission information of the sub-module node of the first module node in the second permission tree can be determined as the target permission information of the sub-module node.

[0107] Optionally, the above method can be described as the following rules:

[0108] Rule 1: If the permission information of the vertex (i.e., the first module node) of the superior role (i.e., the first role) is read-write, then the permissions of all child nodes (i.e., the child module nodes of the first module node) below the vertex of the subordinate role (i.e., the second role) remain unchanged.

[0109] For example, Figure 6 is a schematic diagram of an optional method for determining target permission information of a first module node and a submodule node according to an embodiment of the present invention Figure 1 ,like Figure 6 As shown on the left, the permission information of the upper role vertex A is read-write, and the permission information of the lower role vertex A is empty. According to the above rule 2, the target permission information of the lower role vertex A is empty. Since the permission information of the upper role vertex A is read-write, according to rule 1, the permissions of all child nodes under the lower role vertex A remain unchanged, that is, the permissions of nodes B, C, and D remain unchanged. Finally, the target permission information of each module node is as follows Figure 6 Shown on the right.

[0110] In some embodiments, when the permission level of the second permission information is the highest permission level, based on the inheritance mechanism, it is determined that the permission level of all sub-modules under the first module node in the second permission tree is also the highest permission level. Therefore, in order to meet the conditions of permission range restriction, the permission information of the sub-module node of the first module node in the first permission tree is used as the target permission information of the sub-module node.

[0111] Optionally, the above method can be described as the following rules:

[0112] Rule 2: If the permission information of the subordinate role vertex is read-write, the child node of the subordinate role vertex is set to the same permission information as the child node of the superior role vertex.

[0113] For example, Figure 7 is a schematic diagram of an optional method for determining target permission information of a first module node and a submodule node according to an embodiment of the present invention Figure 2 ,like Figure 7 As shown on the left, the permission information of the upper role vertex A is empty, and the permission information of the lower role vertex is read-write. Applying the above rule 3, the target permission information of the lower role vertex A is empty. Since the permission information of the lower role vertex A is read-write, applying the above rule 2, the child node permission of the lower role vertex A is set to the permission information of the child nodes below the upper role vertex A. Finally, the target permission information of each module node is as follows Figure 7 Shown on the right.

[0114] In some embodiments, when the permission level of the first permission information and the permission level of the second permission information are not the highest permission level, it is impossible to directly determine the target permission information of the submodule node based on the permission level of the first permission information and the permission level of the second permission information. Therefore, the target processing system can determine the submodule node directly connected to the first module node in the second permission tree as the updated first module node.

[0115] Afterwards, after determining the updated first module node, determine the target permission information of the updated first module node in the second permission tree, and if there is a sub-module node in the updated first module node, determine the target permission information of the sub-module node of the updated first module node in the second permission tree. Repeat this process until there is no sub-module node under the updated first module node. Among them, the process of determining the target permission information of the updated first module node in the second permission tree can refer to the process of determining the target permission information of the first module node, and the process of determining the target permission information of the sub-module node of the updated first module node in the second permission tree can refer to the process of determining the target permission information of the sub-module node of the first module node, so it will not be repeated here.

[0116] It should be noted that, by directly determining the target permission information of the submodule node when the permission level of the first permission information is the highest permission level, or when the permission level of the second permission information is the highest permission level, the efficiency of determining the target permission information is improved, thereby improving the efficiency of permission update. By determining the submodule node as the updated first module node when the permission level of the first permission information and the permission level of the second permission information are not the highest permission level, and determining the target permission information accordingly, it is realized that the method of determining the target permission information is selected according to the actual situation, thereby improving the flexibility and accuracy of determining the target permission information.

[0117] In an optional embodiment, in the permission tree, for each module node, if the permission information of the module node is non-empty and there is a target module node, the target module node is in a hidden state in the permission tree, wherein the target module node is a sub-module node directly connected to the module node and has the same permission information as the module node, wherein, in the process of determining the sub-module node directly connected to the first module node in the second permission tree as the updated first module node, the target processing system can restore display of the target module node corresponding to the first module node in the second permission tree when the permission information of the first module node in the second permission tree is non-empty, and obtain the processed second permission tree, thereby determining the sub-module node directly connected to the first module node in the processed second permission tree as the updated first module node.

[0118] Optionally, in some embodiments, in the permission tree, for each module node, if the permission information of the module node is non-empty and there is a target module node, the target module node is hidden in the permission tree. That is, if a module in the module tree does not appear in the permission tree, there are two possibilities. 1: If the corresponding node of the parent module of the module appears in the permission tree and the permission information is non-empty, the permissions of the role for the module and all sub-modules of the module are the same as the permissions of the parent module; 2: If all the corresponding nodes of the parent modules of the module do not appear in the permission tree, or appear in the permission tree and the permission information is empty, the role does not have any permissions for the module and all its sub-modules.

[0119] Therefore, the permission tree corresponding to the same role permission is not unique, and the form of the permission tree is diverse. The diversity of the permission tree form is reflected in the following two situations:

[0120] 1. If the permission information of a node (i.e., module node) in the permission tree is read-write, then adding or deleting any child node (i.e., submodule node) to the node does not change the permissions represented, that is, the two permission trees are equivalent. For example, Figure 8 is a schematic diagram of an optional equivalent permission tree according to an embodiment of the present invention Figure 1 , Figure 8 The two permission trees in are equivalent permission trees.

[0121] 2. If the permission information of a node in the permission tree is read-only (or write-only), then adding or deleting any child node with read-only (or write-only) permission information to the node will not change the permissions represented, that is, the two permission trees are equivalent. For example, Fig. 9 is a schematic diagram of an optional equivalent permission tree according to an embodiment of the present invention Figure 2 , Fig. 9 The two permission trees in are equivalent permission trees.

[0122] Therefore, in order to avoid missing these hidden target module nodes in the second permission tree when comparing the module nodes in the first permission tree and the second permission tree, when the permission level of the first permission information and the permission level of the second permission information are not the highest permission level, if the permission information of the first module node in the second permission tree is not empty, it can be determined that there are hidden target module nodes under the first module node. In this case, the target processing system can restore the display of the target module node corresponding to the first module node in the second permission tree to obtain the processed second permission tree.

[0123] Optionally, after obtaining the processed second permission tree, the target processing system may determine the submodule node directly connected to the first module node in the processed second permission tree as the updated first module node. Figure 3 In the permission tree shown in , if the first module node is the root node, module node A is a sub-module node directly connected to the first module node; if the first module node is module node A, module node C is a sub-module node directly connected to the first module node.

[0124] In some embodiments, when the permission information of the first module node in the second permission tree is empty, the submodule node directly connected to the first module node in the second permission tree is directly determined as the updated first module node.

[0125] It should be noted that, through the above process, the omission of the target module node that has been hidden in the second permission tree is avoided when determining the updated first module node, thereby further improving the accuracy of the determined updated second permission tree, that is, improving the accuracy of the permission update.

[0126] In an optional embodiment, in a permission tree, for each module node, if the permission information of the module node is non-empty and there is a target module node, the target module node is in a hidden state in the permission tree, wherein the target module node is a sub-module node directly connected to the module node and has the same permission information as the module node, wherein, in the process of determining the target permission information of the updated first module node in the second permission tree, the target processing system can restore display of the target module node corresponding to the first module node in the first permission tree when the permission information of the first module node in the first permission tree is non-empty, and obtain the processed first permission tree, thereby determining the target permission information of the updated first module node in the second permission tree based on the processed first permission tree.

[0127] Optionally, since there may also be hidden target module nodes in the first permission tree, in order to avoid missing these hidden target module nodes in the first permission tree when comparing module nodes in the first permission tree and the second permission tree, after determining the updated first module node, if the permission information of the first module node in the first permission tree is non-empty, it can be determined that there is a hidden target module node under the first module node. In this case, the target processing system can restore the display of the target module node corresponding to the first module node in the first permission tree to obtain the processed first permission tree.

[0128] Afterwards, the target processing system may determine target permission information of the updated first module node in the second permission tree according to the processed first permission tree.

[0129] It should be noted that, through the above process, the omission of the target module node that has been hidden in the first permission tree is avoided when determining the target permission information of the updated first module node, thereby further improving the accuracy of the determined updated second permission tree, that is, improving the accuracy of the permission update.

[0130] In an optional embodiment, in the process of determining target permission information of an updated first module node in a second permission tree based on a processed first permission tree, the target processing system may determine whether the processed first permission tree includes an updated first module node, thereby determining target permission information of the updated first module node in the second permission tree based on the processed first permission tree when the processed first permission tree includes the updated first module node.

[0131] Optionally, if the processed first permission tree does not include the updated first module node, it is determined that the role does not have the permission to the functional module corresponding to the updated first module node. In this case, the target processing system can directly delete the updated first module node from the second permission tree.

[0132] Optionally, if the processed first permission tree includes the updated first module node, the target processing system can determine the target permission information of the updated first module node in the second permission tree based on the processed first permission tree. For example, the permission information of the updated first module node in the processed first permission tree is determined to obtain the third permission information, and the permission information of the updated first module node in the second permission tree or the processed second permission tree is determined to obtain the third permission information. According to the respective permission levels of the third permission information and the fourth permission information, the target permission information of the updated first module node in the second permission tree is determined. Optionally, in this embodiment, the process of determining the target permission information of the updated first module node in the second permission tree can refer to the process of determining the target permission information of the first module node, and the process of determining the target permission information of the sub-module node of the updated first module node in the second permission tree can refer to the process of determining the target permission information of the sub-module node of the first module node, so it will not be repeated here.

[0133] Optionally, the above method of determining the updated target permission information of the first module node can be described as the following rules:

[0134] Rule 3: If the permission information of the vertices (i.e., the first module node) of the superior role and the subordinate role is empty, perform the following operations on the child node of the vertex of the subordinate role (i.e., the updated first module node):

[0135] 1. If the child node does not appear in the child nodes below the parent role vertex, remove the child node from the second permission tree;

[0136] 2. If the child node appears in the child nodes below the upper role vertex, then find the permission information of the child node of the upper role, and determine the target permission information of the child node in the permission tree of the lower role (i.e., the second permission tree) according to rules 1-5.

[0137] In some embodiments, for the second operation in rule three, if there are child nodes under the child node, the child node is taken as the vertex, and based on the permission information of the child node in the permission tree of the upper role and the permission information of the child node in the permission tree of the lower role, the target permission information of the child node of the child node in the permission tree of the lower role is determined.

[0138] For example, Fig.10 is a schematic diagram of an optional method for determining target permission information of a first module node and a submodule node according to an embodiment of the present invention Figure 3 ,like Fig.10As shown on the far left, the permission information of both the superior role and the subordinate role vertex A is empty. Applying the above rule 3, the target permission information of the subordinate role vertex A is empty. The child node D below the subordinate role vertex A does not exist in the child nodes below the superior role vertex A, so the child node is removed in the second permission tree. The child node B below the subordinate role vertex A exists in the child nodes below the superior role vertex A, so the superior and subordinate roles are linked again with B as the updated vertex (as shown in the figure). Fig.10 As shown in the dotted box, according to rule 2 in the above rules 1-5, the target permission information of node B in the subordinate role is determined to be read-only. Finally, the target permission information of each module node is as follows Fig.10 as shown on the far right.

[0139] Rule 4: If the permission information of the upper role vertex (i.e. the first module node) is read-only (write-only) and the permission information of the lower role vertex is empty, perform the following two steps:

[0140] 1. Perform an "equivalence transformation" on the child nodes under the vertex in the permission tree of the superior role (i.e., the first permission tree), that is, restore and display the target module node corresponding to the vertex in the permission tree of the superior role;

[0141] 2. Apply the operations in rule 3 to the transformed permission tree of the superior role (ie, the first permission tree after processing) and the permission tree of the subordinate role (ie, the second permission tree).

[0142] For example, if a child node under the vertex of the subordinate role has no corresponding child node under the vertex of the superior role, then the child node is added to the vertex of the superior role, and the permissions of all nodes in the added child nodes are set to read-only (write-only).

[0143] For example, Fig.11 is a schematic diagram of an optional method for determining target permission information of a first module node and a submodule node according to an embodiment of the present invention Figure 4 ,like Fig.11 As shown on the far left, the permission information of the upper-level role vertex A is read-only, and the permission information of the lower-level role vertex A is empty. Applying the above rule 3, the target permission information of the lower-level role vertex A is empty. Since the permission information of the upper-level role vertex is read-only, it is necessary to perform an "equivalent transformation" on the permission tree of the upper-level role. The child node D below the lower-level role vertex A does not exist under the upper-level role vertex A. Add a child node D to the upper-level role vertex A, and set the permission information of the child node D to read-only. Then use the operation in rule three to perform permission linkage on the upper and lower child nodes B and D respectively. According to the above rules 2 and 4, the target permission information of the lower-level role node B is read-only, and the target permission information of node D is read-only. Finally, the target permission information of each module node is as follows. Fig.11as shown on the far right.

[0144] Rule 5: If the permission information of the subordinate role vertex (i.e. the first module node) is read-only (or write-only) and the permission information of the superior role vertex is empty, perform the following two steps:

[0145] 1. Perform an "equivalence transformation" on the child nodes under the vertex in the permission tree of the subordinate role (i.e., the second permission tree), that is, restore and display the target module node corresponding to the vertex in the permission tree of the subordinate role;

[0146] 2. Apply the operations in rule 3 to the transformed permission tree of the subordinate role (ie, the processed second permission tree) and the permission tree of the superior role (ie, the first permission tree).

[0147] For example, if a child node under the upper role vertex has no corresponding child node under the lower role vertex, then the child node is added to the vertex of the lower role, and the permissions of all nodes in the added child nodes are set to read-only (write-only).

[0148] For example, Fig.12 is a schematic diagram of an optional method for determining target permission information of a first module node and a submodule node according to an embodiment of the present invention Figure 5 ,like Fig.12 As shown on the far left, the permission information of the subordinate role vertex A is read-only, and the permission information of the superior role vertex A is empty. According to the above rule 3, the target permission information of the subordinate role vertex A is empty. Since the permission information of the subordinate role vertex A is read-only, the permission tree of the subordinate role is "equivalently transformed" to add a child node C to the subordinate role vertex A with read-only permission information. Then, the operation in rule three is used. Since the child node D under the subordinate role vertex A has no corresponding child node under the superior role node A, the subordinate role child node D is removed. Then, the permission linkage operation is performed on the superior and inferior role child nodes B and C respectively. According to the above rules 1 and 2, the target permission information of the subordinate role node B is read-write, and the target permission information of node C is read-only. Finally, the target permission information of each module node is as follows. Fig.12 as shown on the far right.

[0149] Rule 6: If the permission information of the upper role vertex (i.e., the first module node) is read-only or write-only, and the permission information of the lower role vertex (i.e., the first module node) is read-only or write-only, then perform the following two steps:

[0150] 1. Perform an "equivalence transformation" on the child nodes under the vertex in the permission tree of the upper and lower roles respectively;

[0151] 2. Apply the operation in rule three to the transformed permission tree of the subordinate role (ie, the processed second permission tree) and the transformed permission tree of the superior role (ie, the processed first permission tree).

[0152] For example, Fig.13 is a schematic diagram of an optional method for determining target permission information of a first module node and a submodule node according to an embodiment of the present invention Figure 6 ,like Fig.13 As shown on the far left, the permission information of the upper and lower role vertices A is read-only. Applying the above rule 1, the permission information of the lower role vertex A remains unchanged. Perform "equivalent changes" on the permission trees of the upper and lower roles respectively. Add a child node D under the upper role vertex A, and the permission information is read-only. Add a child node C under the lower role vertex A, and the permission information is read-only. Use rule three to link the upper and lower role child nodes B, C, and D respectively. Apply the above rules 1, 2, and 4 to obtain the permissions of the lower role nodes B, C, and D as read-write, read-only, and read-only, respectively. The final target permission information of each module node is as follows: Fig.13 As shown in the second column on the right of . Optionally, since the permission information of vertex A is read-only, the C and D nodes in the permission tree of the subordinate role can be removed to obtain the following Fig.13 A more concise form is shown on the far right of FIG.

[0153] It should be noted that, by not determining the target permission information of the updated first module node when the processed first permission tree does not include the updated first module node, redundant operations are effectively avoided, thereby further improving the permission update efficiency.

[0154] In an optional embodiment, in the process of obtaining the permission tree to which the second role belongs and obtaining the second permission tree, the target processing system can obtain the role tree, and then determine the lower role node directly connected to the role node of the first role from the role tree to obtain the role node of the second role, thereby obtaining the second permission tree based on the permission tree corresponding to the role node of the second role. Wherein, the role tree includes multiple layers of role nodes, and in any two adjacent layers of role nodes, the system permission corresponding to the upper role node is higher than the system permission corresponding to the lower role node.

[0155] In some embodiments, the target processing system can determine the second role based on the role tree, and then determine the second permission tree of the second role. Optionally, the role corresponding to the lower role node directly connected to the role node of the first role in the role tree is determined as the second role, thereby determining the permission tree corresponding to the lower role node (i.e., the role node of the second role) directly connected to the role node of the first role as the second permission tree.

[0156] For example, if the first character is character A, then in Figure 4In the example, the lower-level role node directly connected to the role node of the first role is Figure 4 Node B and node C in the , that is, role B and role C are the second role. If the first role is role B, then Figure 4 In the example, the lower-level role node directly connected to the role node of the first role is Figure 4 Node D and node E in , that is, role D and role E are the second role.

[0157] It should be noted that, through the above process, the relationship between multiple roles in the system is represented by tree structure data. By determining the second role based on the role tree, the accuracy and efficiency of determining the second role are improved, which in turn can improve the accuracy and efficiency of determining permission updates.

[0158] In an optional embodiment, after the second permission tree is updated according to the first permission tree, the target processing system can obtain the permission tree of the third role to obtain the third permission tree, thereby updating the third permission tree according to the updated second permission tree, so that the updated system permission range of the third role is within the updated system permission range of the second role. The third role is a role whose system permission range is within the system permission range before the second role is updated.

[0159] Optionally, the permission linkage process of the role tree is to perform permission linkage on the roles of all nodes in a subtree with a certain node as the vertex in the role tree (except the vertex). The vertex is the role whose permission change occurs initially (i.e., the first role). This process consists of permission linkage of multiple adjacent hierarchical roles, that is, each subordinate role performs a role permission linkage with its direct superior. The permission linkage of multiple adjacent hierarchical roles is sequential, and the sequence is from top to bottom along the hierarchy of the role tree. If the direct superiors of two roles are the same, the relative order of the linkage between the two roles and the direct superior can be swapped.

[0160] For example, Fig.14 is a schematic diagram of an optional permission linkage of a role tree according to an embodiment of the present invention. Fig.14 It shows the permission linkage that needs to be performed when the permission of role B changes. This process includes three permission linkages of adjacent roles: permission linkage between D and B, permission linkage between E and B, and permission linkage between G and D. Fig.14 The numbers in the middle represent the order in which the linkage occurs, and the order in which D and E are linked with B can be swapped.

[0161] Therefore, after updating the second permission tree according to the first permission tree, the target processing system can determine whether there is a third role, and if there is a third role, obtain the permission tree of the third role according to the role tree to obtain the third permission tree, and then update the third permission tree according to the updated second permission tree, so that the updated system permission range of the third role is within the updated system permission range of the second role. Optionally, the method for obtaining the third permission tree can refer to the method for obtaining the second permission tree, and the method for updating the third permission tree according to the updated second permission tree can refer to the method for updating the second permission tree according to the first permission book, so it will not be repeated here.

[0162] It should be noted that, through the above process, the permissions of the roles associated with the second role in the system are synchronously updated, thereby further improving the accuracy and efficiency of the role permission update.

[0163] In an optional embodiment, after updating the second permission tree according to the first permission tree, the target processing system can determine the permission tree of the role to which the user belongs when receiving the user's access request, obtain the target permission tree, and then determine the permission chain corresponding to the interface accessed by the access request, and then determine the permission information of the top-level module node in the permission chain that has not been matched in the target permission tree as the current permission information, and determine whether the current permission information matches the reference permission information, so as to allow the access request to access the interface when the current permission information matches the reference permission information. Among them, the permission chain represents the permissions required to access the interface, the permission chain includes multiple module nodes with a hierarchical relationship and the permission information corresponding to the last level module node, and the reference permission information refers to the permission information in the permission chain.

[0164] Optionally, the functions of the system are usually open in the form of interfaces to control user permissions. In addition to determining the permissions of the user's role, it is also necessary to know what permissions the user needs to access the function. Therefore, permissions can be bound to the interface in advance.

[0165] In this embodiment, the interface permission is represented as a set of permission chains, each interface can be bound to one or more permission chains, a permission chain represents the permission of which module is required to access the bound interface, and the permission chain consists of two parts: "module chain" and "permission information". The module chain includes multiple module nodes with a hierarchical relationship, and the last node of the module chain (that is, the last level module node) represents the target module with specific permission requirements. The other module nodes in the module chain except the last node represent all modules passed through in the process of walking down the module tree from the "root module" to the target module. "Permission information" can be "read-only", "read-write", or "write-only", "read-only", "read-write". The permission information in the permission chain represents the permission required to access the module (that is, to access the interface corresponding to the module). Optionally, the interface can be bound to multiple permission chains, and as long as the user's permission meets any permission chain, access to the interface is allowed.

[0166] In some embodiments, the hierarchical relationship between module nodes in the permission chain is the same as the hierarchical relationship between the modules corresponding to the module nodes in the system, that is, the hierarchical relationship between module nodes in the permission chain is the same as the hierarchical relationship between the modules corresponding to the module nodes in the module tree.

[0167] For example, Fig.15 is a schematic diagram of an optional permission chain according to an embodiment of the present invention Figure 1 , Fig.15 The permission chain in Figure 2 The module tree in Fig.15 In the example, the target module is module D in the module tree, and the permission information is "read". If an interface is bound to this permission chain, it means that if the user accessing the interface has the read permission of module D, access is allowed, otherwise access is not allowed.

[0168] In some embodiments, upon receiving an access request from a user, the target processing system may determine the permission tree of the role to which the user belongs, and obtain a target permission tree, wherein the target permission tree may be one or more.

[0169] Afterwards, the target processing system may determine the permission information of the top-level module node in the permission chain that has not been matched in the target permission tree as the current permission information. For example, when determining the current permission information for the first time, the permission information of the root module node in the target permission tree is determined as the current permission information.

[0170] Afterwards, the target processing system may determine whether the current permission information matches the reference permission information. Optionally, if the permission range of the reference permission information is within the permission range of the current permission information, it is determined that the current permission information matches the reference permission information, and if the permission range of the reference permission information is not within the permission range of the current permission information, it is determined that the current permission information does not match the reference permission information.

[0171] For example, if the current permission information is read-write, and the reference permission information is read-only or write-only or read-write, the two match. If the current permission information is read-only (or write-only) and the reference permission information is read-only (or write-only), the two match. If it is any other case than the above two cases, it is determined that the two do not match.

[0172] Optionally, if the current permission information matches the reference permission information, access to the requested access interface is allowed.

[0173] It should be noted that by representing the permissions required to access the interface based on the permission chain, a clear and indirect representation of the interface permissions is achieved. By determining whether to allow an access request based on the relationship between the permission chain and the permission tree, the efficiency of information comparison is improved, thereby improving the efficiency of determining user access rights.

[0174] In an optional embodiment, after determining whether the current permission information matches the reference permission information, the target processing system may, if the current permission information does not match the reference permission information, redetermine the top-level module node in the permission chain that has not been matched to redetermine the current permission information, and then repeat the step of determining whether the updated current permission information matches the reference permission information until the updated current permission information matches the reference permission information, in which case access to the requested access interface is allowed, or access to the requested access interface is prohibited until there are no module nodes in the permission chain that have not been matched.

[0175] Optionally, if the current permission information does not match the reference permission information, the target processing system may redetermine the top-level module node that has not been matched from the permission chain to redetermine the current permission information. Fig.15 If the permission information of the root node in does not match, module node A is determined as the top-level module node in the permission chain that has not been matched, and Fig.15 The permission information of the module node A in the target permission tree is determined as the updated current permission information.

[0176] Then repeat the step of determining whether the updated current permission information matches the reference permission information until the updated current permission information matches the reference permission information, in which case access to the request access interface is allowed; or, until there are no module nodes in the permission chain that have not been matched, in which case it is determined that the permission chain does not match the target permission tree, and access to the request access interface is prohibited.

[0177] In some embodiments, if there are multiple target permission trees corresponding to the user, then if there are no module nodes in the permission chain that have not been matched, the permission chain is matched based on the target permission trees other than the current target permission tree. Thus, if all target permission trees do not match the permission chain, access to the request access interface is prohibited; if there is a match between the target permission tree and the permission chain, access to the request access interface is allowed.

[0178] In some embodiments, if there are multiple permission chains corresponding to the interface, then if there is no module node in the permission chain that has not been matched, the permission chain other than the current permission chain is matched with the target permission tree, so that if all permission chains do not match the target permission tree, the access request to the interface is prohibited. If there is a match between the target permission tree and the permission chain, the access request to the interface is allowed.

[0179] In some embodiments, if there are multiple target permission trees corresponding to the user and multiple permission chains corresponding to the interface, then if there are no matching target permission trees and permission chains, the access request to the interface is prohibited. If there are matching target permission trees and permission chains, the access request to the interface is allowed.

[0180] For example, Figure 3 The permission tree shown in Fig.15 Take the permission chain shown in as an example to perform permission matching. The permission information of the permission chain is read-only, and the module chain is root module->module A->module D, which means that the permission required to access the interface is the read permission of module D. The first node in the module chain corresponds to the root module, and the corresponding module node in the permission tree is found. This module node has no permission information, so this module node does not match the permission of the permission chain. Then match the next node. The second module node in the module chain corresponds to module A, and the corresponding module node in the permission tree is found. The permission information of this module node is read-only, matching the read-only permission. Therefore, the permission tree matches the permission chain, allowing access to the corresponding interface.

[0181] For another example, change the read-write permission of permission chain 15 to write-only permission, and you will get: Fig.16 The permission chain shown in the figure is as follows: Fig.16As shown, the permission information of the permission chain is write, and the module chain is root module->module A->module D, which means that the permission required to access the interface is the write-only permission of module D. The first node in the module chain corresponds to the root module, and the corresponding module node in the permission tree is found. The module node has no permission information, so the module node does not match the permission chain permission. Then the next module is matched. The second module node in the module chain corresponds to module A. The corresponding module node in the permission tree is found. The permission information of the module node is read-only, and the node does not match the permission chain permission. Then the next round of matching is carried out. The next module node in the module chain is module D. The corresponding module node cannot be found in the permission tree, so all nodes in the permission tree do not match, so the permission tree does not match the permission chain, and access to the interface is not allowed.

[0182] It should be noted that by matching the module nodes in the permission chain with the target permission tree in sequence, and prohibiting access to the request access interface when all module nodes in the permission chain fail to match, the omission of module nodes in the permission chain is avoided, thereby improving the accuracy of determining access rights.

[0183] It can be seen that the solution provided by the present application achieves the purpose of linkage update of role permissions based on the permission tree, thereby realizing the technical effect of improving the efficiency of permission update, and further solving the technical problem of low efficiency in updating the permissions of roles restricted by the permissions of a role in the system when the related technology updates the permissions of the role.

[0184] Example 2

[0185] According to an embodiment of the present invention, an embodiment of a device for updating role authority is provided, wherein: Fig.17 is a schematic diagram of an optional device for updating role permissions according to an embodiment of the present invention, such as Fig.17 As shown, the device comprises:

[0186] The first acquisition module 1701 is used to acquire the permission tree of the updated system permission of the first role when detecting that the system permission of the first role is updated, and obtain a first permission tree, wherein the first permission tree is used to represent the permission of the first role for each functional module in the system;

[0187] The second acquisition module 1702 is used to acquire the permission tree to which the second role belongs, and obtain the second permission tree, wherein the second role is a role whose system permission range is within the system permission range before the first role is updated;

[0188] The first updating module 1703 is used to update the second permission tree according to the first permission tree, so that the updated system permission range of the second role is within the updated system permission range of the first role.

[0189] It should be noted that the above-mentioned first acquisition module 1701, second acquisition module 1702 and first update module 1703 correspond to steps S101 to S103 in the above-mentioned embodiment, and the examples and application scenarios implemented by the three modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned embodiment 1.

[0190] Optionally, the permission tree includes multiple layers of module nodes, and each module node has permission information, wherein the first update module also includes: a first determination submodule, used to determine the first module node from the second permission tree, wherein the first module node is a module node for target permission information to be determined; a second determination submodule, used to determine the permission information of the first module node in the first permission tree to obtain the first permission information, and determine the permission information of the first module node in the second permission tree to obtain the second permission information; a third determination submodule, used to determine the target permission information of the first module node in the second permission tree according to the respective permission levels of the first permission information and the second permission information; an update submodule, used to update the second permission tree according to the determined target permission information when the determined target permission information is different from the second permission information.

[0191] Optionally, the device for updating role permissions also includes: a first determination module, which is used to determine the target permission information of the sub-module node of the first module node in the second permission tree according to the respective permission levels of the first permission information and the second permission information when a sub-module node exists in the first module node.

[0192] Optionally, the third determination submodule also includes: a first determination unit, used to determine the second permission information as the target permission information of the first module node if the permission level of the first permission information is higher than the permission level of the second permission information, or the first permission information is the same as the second permission information; a second determination unit, used to determine the first permission information as the target permission information of the first module node if the permission level of the first permission information is lower than the permission level of the second permission information; a third determination unit, used to determine the preset permission information as the target permission information of the first module node if the permission level of the first permission information is the same as the permission level of the second permission information, and the first permission information is different from the second permission information.

[0193] Optionally, when the permission information of the module node is non-empty, the sub-module node of the module node inherits the permission information of the module node, wherein the first determination module also includes: a fourth determination sub-module, used to determine that the permission information of the sub-module node of the first module node in the second permission tree is the target permission information of the sub-module node when the permission level of the first permission information is the highest permission level; a fifth determination sub-module, used to determine that the permission information of the sub-module node of the first module node in the first permission tree is the target permission information of the sub-module node when the permission level of the second permission information is the highest permission level; a sixth determination sub-module, used to determine the sub-module node directly connected to the first module node in the second permission tree as the updated first module node when neither the permission level of the first permission information nor the permission level of the second permission information is the highest permission level; a seventh determination sub-module, used to determine the target permission information of the updated first module node in the second permission tree, and when the updated first module node has a sub-module node, determine the target permission information of the sub-module node of the updated first module node in the second permission tree.

[0194] Optionally, in the permission tree, for each module node, if the permission information of the module node is non-empty and there is a target module node, the target module node is in a hidden state in the permission tree, wherein the target module node is a sub-module node directly connected to the module node and has the same permission information as the module node, wherein the sixth determination sub-module also includes: a first processing unit, used to restore and display the target module node corresponding to the first module node in the second permission tree when the permission information of the first module node in the second permission tree is non-empty, so as to obtain a processed second permission tree; a fourth determination unit, used to determine the sub-module node directly connected to the first module node in the processed second permission tree as the updated first module node.

[0195] Optionally, in the permission tree, for each module node, if the permission information of the module node is non-empty and there is a target module node, the target module node is in a hidden state in the permission tree, wherein the target module node is a sub-module node directly connected to the module node and has the same permission information as the module node, wherein the seventh determination sub-module also includes: a first processing unit, used to restore and display the target module node corresponding to the first module node in the first permission tree when the permission information of the first module node in the first permission tree is non-empty, so as to obtain the processed first permission tree; a fifth determination unit, used to determine the target permission information of the updated first module node in the second permission tree based on the processed first permission tree.

[0196] Optionally, the fifth determination unit also includes: a judgment subunit, used to judge whether the processed first permission tree includes the updated first module node; a determination subunit, used to determine the target permission information of the updated first module node in the second permission tree according to the processed first permission tree when the processed first permission tree includes the updated first module node.

[0197] Optionally, the second acquisition module also includes: a first acquisition sub-module, used to acquire a role tree, wherein the role tree includes multiple layers of role nodes, and in any two adjacent layers of role nodes, the system permissions corresponding to the upper role nodes are higher than the system permissions corresponding to the lower role nodes; an eighth determination sub-module, used to determine the lower role node directly connected to the role node of the first role from the role tree to obtain the role node of the second role; and a second acquisition sub-module, used to obtain a second permission tree based on the permission tree corresponding to the role node of the second role.

[0198] Optionally, the role authority updating device also includes: a third acquisition module, used to acquire the authority tree of the third role, to obtain the third authority tree, wherein the third role is a role whose system authority range is within the system authority range before the second role is updated; a second update module, used to update the third authority tree according to the updated second authority tree, so that the updated system authority range of the third role is within the updated system authority range of the second role.

[0199] Optionally, the device for updating role permissions also includes: a second determination module, which is used to determine the permission tree of the role to which the user belongs and obtain a target permission tree when receiving an access request from the user; a third determination module, which is used to determine the permission chain corresponding to the interface accessed by the access request, wherein the permission chain represents the permissions required to access the interface, and the permission chain includes multiple module nodes with a hierarchical relationship and permission information corresponding to the last-level module node; a judgment module, which is used to determine the permission information of the top-level module node in the permission chain that has not been matched in the target permission tree as the current permission information, and to judge whether the current permission information matches the reference permission information, wherein the reference permission information refers to the permission information in the permission chain; a first processing module, which is used to allow the access request to access the interface when the current permission information matches the reference permission information.

[0200] Optionally, the device for updating role permissions also includes: a fourth determination module, used to redetermine the top-level module node that has not been matched from the permission chain to redetermine the current permission information when the current permission information does not match the reference permission information; a second processing module, used to repeatedly execute the step of determining whether the updated current permission information matches the reference permission information until the updated current permission information matches the reference permission information, in which case access to the request access interface is allowed, or access to the request access interface is prohibited until there are no module nodes in the permission chain that have not been matched.

[0201] Example 3

[0202] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, wherein: Fig.18 is a schematic diagram of an optional electronic device according to an embodiment of the present invention, such as Fig.18 As shown, the electronic device includes one or more processors; a memory for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the above-mentioned when running.

[0203] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0204] The embodiments or examples of the present disclosure are not exhaustive, but are only illustrative of some embodiments or examples, and are not intended to be specific limitations on the scope of protection of the present disclosure. In the absence of contradiction, each step in a certain embodiment or example can be implemented as an independent example, and the steps can be combined arbitrarily. For example, the scheme after removing some steps in a certain embodiment or example can also be implemented as an independent example, and the order of the steps in a certain embodiment or example can be arbitrarily exchanged. In addition, the optional methods or optional examples in a certain embodiment or example can be combined arbitrarily; in addition, the various embodiments or examples can be combined arbitrarily, for example, some or all steps of different embodiments or examples can be combined arbitrarily, and a certain embodiment or example can be combined arbitrarily with the optional methods or optional examples of other embodiments or examples.

[0205] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0206] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0207] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0208] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0209] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for updating role permissions, characterized in that: include: In the case of detecting that the system permission of the first role is updated, obtaining a permission tree after the system permission of the first role is updated to obtain a first permission tree, wherein the first permission tree is used to represent the permissions that the first role has for each functional module in the system; Obtaining a permission tree to which a second role belongs, and obtaining a second permission tree, wherein the second role is a role whose system permission range is within the system permission range before the first role is updated; The second permission tree is updated according to the first permission tree so that the updated system permission range of the second role is within the updated system permission range of the first role.

2. The method according to claim 1, characterized in that The permission tree includes multiple layers of module nodes, each of which has permission information, wherein updating the second permission tree according to the first permission tree includes: Determine a first module node from the second permission tree, wherein the first module node is a module node of target permission information to be determined; Determine the permission information of the first module node in the first permission tree to obtain first permission information, and determine the permission information of the first module node in the second permission tree to obtain second permission information; Determining target permission information of the first module node in the second permission tree according to respective permission levels of the first permission information and the second permission information; When the determined target permission information is different from the second permission information, the second permission tree is updated according to the determined target permission information.

3. The method according to claim 2, characterized in that After determining target permission information of the first module node in the second permission tree, the method further includes: In the case where the first module node has a submodule node, target permission information of the submodule node of the first module node in the second permission tree is determined according to the respective permission levels of the first permission information and the second permission information.

4. The method according to claim 2 or 3, characterized in that: Determining target permission information of the first module node in the second permission tree according to respective permission levels of the first permission information and the second permission information includes: If the permission level of the first permission information is higher than the permission level of the second permission information, or the first permission information is the same as the second permission information, determining the second permission information as the target permission information of the first module node; If the permission level of the first permission information is lower than the permission level of the second permission information, determining the first permission information as the target permission information of the first module node; If the permission level of the first permission information is the same as the permission level of the second permission information, and the first permission information is different from the second permission information, the preset permission information is determined as the target permission information of the first module node.

5. The method according to claim 3, characterized in that: In the case where the permission information of the module node is not empty, the submodule node of the module node inherits the permission information of the module node, wherein, according to the respective permission levels of the first permission information and the second permission information, determining the target permission information of the submodule node of the first module node in the second permission tree includes: In a case where the permission level of the first permission information is the highest permission level, determining the permission information of the submodule node of the first module node in the second permission tree as the target permission information of the submodule node; In a case where the permission level of the second permission information is the highest permission level, determining the permission information of the submodule node of the first module node in the first permission tree as the target permission information of the submodule node; In the case where the permission level of the first permission information and the permission level of the second permission information are not the highest permission level, determining a submodule node directly connected to the first module node in the second permission tree as an updated first module node; Determine the target permission information of the updated first module node in the second permission tree, and if the updated first module node has a sub-module node, determine the target permission information of the sub-module node of the updated first module node in the second permission tree.

6. The method according to claim 5, characterized in that In the permission tree, for each module node, if the permission information of the module node is not empty and there is a target module node, the target module node is in a hidden state in the permission tree, wherein the target module node is a sub-module node directly connected to the module node and having the same permission information as the module node, wherein the sub-module node directly connected to the first module node in the second permission tree is determined as the updated first module node, including: When the permission information of the first module node in the second permission tree is not empty, restoring and displaying the target module node corresponding to the first module node in the second permission tree to obtain a processed second permission tree; A submodule node directly connected to the first module node in the processed second permission tree is determined as the updated first module node.

7. The method according to claim 5, characterized in that In the permission tree, for each module node, if the permission information of the module node is not empty and there is a target module node, the target module node is in a hidden state in the permission tree, wherein the target module node is a submodule node directly connected to the module node and having the same permission information as the module node, wherein determining the target permission information of the updated first module node in the second permission tree includes: When the permission information of the first module node in the first permission tree is not empty, restoring and displaying the target module node corresponding to the first module node in the first permission tree to obtain a processed first permission tree; According to the processed first permission tree, target permission information of the updated first module node in the second permission tree is determined.

8. The method according to any one of claims 1 to 3, characterized in that Get the permission tree to which the second role belongs, and obtain the second permission tree, including: Obtaining a role tree, wherein the role tree includes multiple layers of role nodes, and in any two adjacent layers of role nodes, the system authority corresponding to the upper layer role node is higher than the system authority corresponding to the lower layer role node; Determine from the character tree a lower-level character node directly connected to the character node of the first character, and obtain a character node of the second character; The second permission tree is obtained according to the permission tree corresponding to the role node of the second role.

9. The method according to any one of claims 1 to 3, characterized in that: After updating the second permission tree according to the first permission tree, the method further includes: Acquire a permission tree of a third role to obtain a third permission tree, wherein the third role is a role whose system permission range is within the system permission range before the second role is updated; The third permission tree is updated according to the updated second permission tree, so that the updated system permission range of the third role is within the updated system permission range of the second role.

10. The method according to any one of claims 1 to 3, characterized in that: After updating the second permission tree according to the first permission tree, the method further includes: When receiving an access request from a user, determining the permission tree of the role to which the user belongs, and obtaining a target permission tree; Determine a permission chain corresponding to the interface accessed by the access request, wherein the permission chain represents the permission required to access the interface, and the permission chain includes a plurality of module nodes having a hierarchical relationship and permission information corresponding to the last-level module node; Determine the permission information of the top-level module node in the permission chain that has not been matched in the target permission tree as the current permission information, and determine whether the current permission information matches the reference permission information, wherein the reference permission information refers to the permission information in the permission chain; In a case where the current permission information matches the reference permission information, the access request is allowed to access the interface.

11. The method according to claim 10, characterized in that After determining whether the current permission information matches the reference permission information, the method further includes: In the case where the current permission information does not match the reference permission information, re-determining the top-level module node that has not been matched from the permission chain to re-determine the current permission information; Repeat the step of determining whether the updated current permission information matches the reference permission information until the updated current permission information matches the reference permission information, in which case the access request is allowed to access the interface, or until there are no module nodes in the permission chain that have not been matched, in which case the access request is prohibited from accessing the interface.

12. A device for updating role authority, characterized in that: include: A first acquisition module is used to acquire a permission tree after the system permission of the first role is updated, and obtain a first permission tree, wherein the first permission tree is used to represent the permissions that the first role has for each functional module in the system; A second acquisition module is used to acquire a permission tree to which a second role belongs, and obtain a second permission tree, wherein the second role is a role whose system permission range is within the system permission range before the first role is updated; The first updating module is used to update the second permission tree according to the first permission tree so that the updated system permission range of the second role is within the updated system permission range of the first role.

13. An electronic device, characterized in that: The electronic device includes one or more processors; A memory for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the method for updating role permissions described in any one of claims 1 to 11 during runtime.

Citation Information

Cited By

  • Fine-grained resource access control method based on ACL (access control list)

    CN121256832A