A method, device, equipment and storage medium for determining user authority

By obtaining the user's role parent-child relationship information from the role relationship table and generating a dictionary, combining the role identification list to determine the collection in the memory, and obtaining the permission information from the permission control table, the problem of too long permission acquisition time is solved and efficiency is improved.

CN117056885BActive Publication Date: 2024-08-23GUANGZHOU YINGFENG NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310909840.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-21
Publication Date
2024-08-23
Estimated Expiration
2043-07-21

AI Technical Summary

Technical Problem

Existing permission control components often cause user permission acquisition to take too long and have low efficiency during frequent lock and release operations.

Method used

By obtaining the user's role parent-child relationship information from the role relationship table, a role parent-child relationship dictionary is generated, and based on the dictionary and the role identification list, the role identification collection of the target user is determined in the memory, and the rights owned by the target user are obtained from the permission control table. Permission information corresponding to roles and inherited roles reduces the number of accesses and lock operations to the permission control table.

Benefits of technology

It effectively shortens the time for user permission acquisition, improves the efficiency of permission acquisition, reduces the frequency of lock and release lock operations on the permission control table, and improves the efficiency of permission management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117056885B
    Figure CN117056885B
Patent Text Reader

Abstract

The embodiment of the present application discloses a method, device, equipment and storage medium for determining user authority. The technical solution provided by the embodiment of the present application obtains the user's role parent-child relationship information from the role relationship table, generates a role parent-child relationship dictionary in the memory according to the role parent-child relationship information, obtains the target user's role identification list from the authority control table, and determines the target user's role identification collection in the memory according to the role parent-child relationship dictionary and the role identification list, obtains the role owned by the target user and the corresponding authority information of the inherited role from the authority control table according to the role identification collection, effectively reduces the number of requests for data from the authority control table, reduces the locking and releasing operations on the authority control table, effectively shortens the time to obtain user authority, and improves the efficiency of obtaining user authority.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to a method, apparatus, device and storage medium for determining user authority. Background Art

[0002] In various business systems, permission control is basically indispensable. For example, in the game system, the permissions of the system administrator's menu logo and game logo are often managed. The system administrator can manage the game according to the permissions of the menu logo and game logo he has. Common permission management models include ACL (Access Control List), RBAC (Role-Based Access Control), ABAC (AttributeBased Access Control), etc. The permission management model is often used in conjunction with permission control components (such as the permission control open source component casbin).

[0003] When a user needs to obtain permission information, in order to prevent data inconsistency, the permission control component will lock the permission control table when obtaining the permission information corresponding to the user's role and sub-role. However, frequent lock and release operations will cause the user permission acquisition time to be too long, and the user permission acquisition efficiency is low. Summary of the invention

[0004] The embodiments of the present application provide a method, apparatus, device and storage medium for determining user rights to solve the technical problems in the related art that frequent locking and releasing operations on the permission control table will result in too long a time to obtain user rights and low efficiency in obtaining user rights, thereby effectively shortening the time to obtain user rights and improving the efficiency of obtaining user rights.

[0005] In a first aspect, an embodiment of the present application provides a method for determining user rights, including:

[0006] Obtaining the user's role parent-child relationship information from the role relationship table, and generating a role parent-child relationship dictionary in memory according to the role parent-child relationship information;

[0007] Obtaining a role identification list of the target user from the authority control table, wherein the role identification list records the role identifications owned by the target user;

[0008] According to the role parent-child relationship dictionary and the role identifier list, determining a role identifier collection of the target user in a memory, wherein the role identifier collection records the role identifiers owned by the target user and the inherited role identifiers;

[0009] The authority information corresponding to the roles owned by the target user and the inherited roles is obtained from the authority control table according to the collection of role identifiers.

[0010] In a second aspect, an embodiment of the present application provides a user authority determination device, including a relationship acquisition module, a role acquisition module, an identification acquisition module and a authority determination module, wherein:

[0011] The relationship acquisition module is used to acquire the user's role parent-child relationship information from the role relationship table, and generate a role parent-child relationship dictionary in the memory according to the role parent-child relationship information;

[0012] The role acquisition module is used to acquire a role identification list of a target user from a permission control table, wherein the role identification list records role identifications owned by the target user;

[0013] The identification acquisition module is used to determine the role identification collection of the target user in the memory according to the role parent-child relationship dictionary and the role identification list, wherein the role identification collection records the role identifications owned by the target user and the inherited role identifications;

[0014] The permission determination module is used to obtain permission information corresponding to the roles owned by the target user and the inherited roles from the permission control table according to the set of role identifiers.

[0015] In a third aspect, an embodiment of the present application provides a user authority determination device, including: a memory and one or more processors;

[0016] The memory is used to store one or more programs;

[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the user authority determination method as described in the first aspect.

[0018] In a fourth aspect, an embodiment of the present application provides a storage medium storing computer executable instructions, which, when executed by a computer processor, are used to execute the user authority determination method as described in the first aspect.

[0019] The embodiment of the present application obtains the user's role parent-child relationship information from the role relationship table, generates a role parent-child relationship dictionary in the memory according to the role parent-child relationship information, obtains the target user's role identification list from the permission control table, and determines the target user's role identification collection in the memory according to the role parent-child relationship dictionary and the role identification list, obtains the permission information corresponding to the role owned by the target user and the inherited role from the permission control table according to the role identification collection, effectively reduces the number of times data is requested from the permission control table, reduces the locking and releasing operations on the permission control table, effectively shortens the time for obtaining user permissions, and improves the efficiency of obtaining user permissions. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a flow chart of a method for determining user authority provided in an embodiment of the present application;

[0021] Figure 2 is a flow chart of another method for determining user authority provided in an embodiment of the present application;

[0022] Figure 3 It is a structural diagram of a user authority determination device provided in an embodiment of the present application;

[0023] Figure 4 It is a structural diagram of a user authority determination device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The above process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The above process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.

[0025] Figure 1 A flowchart of a user authority determination method provided in an embodiment of the present application is given. The user authority determination method provided in an embodiment of the present application can be executed by a user authority determination device, which can be implemented in hardware and / or software and integrated in a user authority determination device.

[0026] The following description is made by taking the user authority determination device executing the user authority determination method as an example. Figure 1 , the user authority determination method includes:

[0027] S110: Obtaining the user's role parent-child relationship information from the role relationship table, and generating a role parent-child relationship dictionary in memory according to the role parent-child relationship information.

[0028] This solution can configure a permission control component (such as the permission control open source component casbin) in the setting server, and the permission control component can manage the permission control table (such as the casbin relationship table). The permission control table provided by this solution can be used to record the role identification (role id) of the role owned by the user and the permissions corresponding to each role identification. The role relationship table provided by this solution records the role parent-child relationship information that reflects the parent-child relationship between various roles. The role relationship table and permission control table provided by this solution can be recorded in the set database, and the role relationship table and permission control table can be saved in the same database or in different databases. Optionally, the database provided by this solution can be a distributed database.

[0029] For example, when the target user needs to obtain the permissions that he or she has, the user permission determination device can be used to request all role parent-child relationship information from the role relationship table, and generate a role parent-child relationship dictionary (role parent-child relationship map) in its own memory based on the obtained role parent-child relationship information. For example, the role parent-child relationship dictionary can record the correspondence between the child role id and the parent role pid.

[0030] S120: Obtain a role identification list of the target user from the authority control table, where the role identification list records the role identifications owned by the target user.

[0031] The user roles provided by this solution include roles directly owned by the user and roles indirectly owned by the user. There may be a parent-child relationship between the directly owned roles and the indirectly owned roles, that is, the indirectly owned roles may be inherited from the directly owned roles based on the parent-child relationship. Each role may correspond to one or more permissions. For example, the corresponding permissions of the system administrator of the game system may be the management permissions of the menu and game under the role owned by the user (which may be represented by a menu identifier or a game identifier).

[0032] In one embodiment, the permission control component provided by this solution can lock the permission control table when responding to the permission access request to ensure data consistency. When the permission access is completed, the permission control component can unlock the permission control table to allow other users to access the permission control table.

[0033] Exemplarily, after generating the role parent-child relationship dictionary in memory, the target user's role identifiers are requested from the authority control table, thereby obtaining the target user's role identifier list from the authority control table. The role identifier list provided by this solution records the role identifiers directly owned by the target user.

[0034] S130: Determine a role identification collection of the target user in the memory according to the role parent-child relationship dictionary and the role identification list. The role identification collection records the role identifications owned by the target user and the inherited role identifications.

[0035] Exemplarily, after obtaining the target user's role identification list, other role identifications associated with the role identifications in each role identification list are determined based on the role parent-child relationship dictionary and the role identification list obtained above, such as determining the role identification corresponding to the child role associated with the role identification, and determining the target user's role identification collection in memory. Among them, the role identification collection provided by this scheme records the role identifications of the roles directly owned by the target user and the role identifications of the inherited roles. This scheme determines the role identifications corresponding to the roles inherited from the roles directly owned by the target user based on the role parent-child relationship dictionary, and does not need to request the inherited role identification from the permission control table, thereby effectively reducing the frequency and time of access to the permission control table, reducing the frequency and duration of lock operations on the permission control table, and improving the efficiency of permission determination.

[0036] S140: Obtaining permission information corresponding to the roles owned by the target user and the inherited roles from the permission control table according to the collection of role identifiers.

[0037] Exemplarily, after obtaining the target user's role identification collection, the permission information corresponding to each role identification in the role identification collection is obtained from the permission control table according to the role identification collection, thereby obtaining the permission information corresponding to the role owned by the target user and the inherited role. After determining the permission information corresponding to the role owned by the target user and the inherited role, the permission management of the target user can be implemented based on the permission information.

[0038] For example, in a game system, the system administrator is the target person. First, the role parent-child relationship information of all users is requested from the role relationship table and a role parent-child relationship dictionary is generated in the memory. Then, the role identification list of the system administrator is obtained from the permission control table, and the role identification collection of the system administrator is determined in the memory according to the role parent-child relationship dictionary and the role identification list. Finally, according to the role identification collection, the permission information corresponding to the roles owned by the system administrator and the inherited roles is obtained from the permission control table, where the permission information of each role may include the management authority for menus and games. The permission information can be identified by the menu identification (menu id) corresponding to the menu and the game identification (game id) corresponding to the game to indicate the management authority for menus and games.

[0039] In the above, by obtaining the user's role parent-child relationship information from the role relationship table, and generating a role parent-child relationship dictionary in memory based on the role parent-child relationship information, obtaining the target user's role identification list from the permission control table, and determining the target user's role identification collection in memory based on the role parent-child relationship dictionary and the role identification list, obtaining the role owned by the target user and the permission information corresponding to the inherited role from the permission control table based on the role identification collection, effectively reducing the number of times data is requested from the permission control table, reducing the locking and releasing operations on the permission control table, effectively shortening the time to obtain user permissions, and improving the efficiency of obtaining user permissions.

[0040] Based on the above embodiments, Figure 2 A flowchart of another method for determining user rights provided in an embodiment of the present application is given, which is a specific embodiment of the above method for determining user rights. Figure 2 , the user authority determination method includes:

[0041] S210: Obtain the user's role parent-child relationship information from the role relationship table, and generate a role parent-child relationship dictionary in memory according to the role parent-child relationship information.

[0042] In a possible embodiment, the user authority determination method provided by the present solution, when obtaining the user's role parent-child relationship information from the role relationship table and generating a role parent-child relationship dictionary in memory according to the role parent-child relationship information, includes:

[0043] S211: Determine whether a role parent-child relationship dictionary is stored in the memory.

[0044] S212: If the role parent-child relationship dictionary is not stored in the memory, the role parent-child relationship information of the user is obtained from the role relationship table, and a role parent-child relationship dictionary is generated in the memory according to the role parent-child relationship information.

[0045] S213: In the case where the role parent-child relationship dictionary is stored in the memory, the role parent-child relationship dictionary is updated based on the dictionary version information of the role parent-child relationship dictionary and the relationship version information of the role relationship table.

[0046] For example, when the target user's permission information needs to be obtained, it can be determined whether a role parent-child dictionary is recorded in the memory. The role parent-child dictionary stored in the memory can be a role parent-child relationship dictionary generated in the previous user permission determination process.

[0047] When the role parent-child relationship dictionary is not stored in the memory, the user's role parent-child relationship information is obtained from the role relationship table, and the role parent-child relationship dictionary is generated in the memory according to the role parent-child relationship information. The acquisition of the role parent-child relationship information and the generation of the role parent-child relationship dictionary can refer to the above embodiment, and this solution will not be repeated.

[0048] When a role parent-child relationship dictionary is stored in the memory, the dictionary version information of the role parent-child relationship dictionary and the relationship version information of the role relationship table are determined, and the role parent-child relationship dictionary is updated based on the dictionary version information of the role parent-child relationship dictionary and the relationship version information of the role relationship table.

[0049] For example, when the dictionary version information of the role parent-child relationship dictionary is consistent with the relationship version information of the role relationship table, the role parent-child relationship dictionary stored in the memory is directly used as the role parent-child relationship dictionary used in the current user authority determination process, and there is no need to obtain the role parent-child relationship information of all users from the role relationship table, thereby improving the efficiency of determining the role parent-child relationship dictionary and the efficiency of determining user authority. When the dictionary version information of the role parent-child relationship dictionary is inconsistent with the relationship version information of the role relationship table, it is necessary to update the role parent-child relationship dictionary currently stored in the memory according to the role parent-child relationship dictionary recorded in the role relationship table, so as to keep the dictionary version information of the updated role parent-child relationship dictionary consistent with the relationship version information of the role relationship table, and ensure the accuracy of user authority determination.

[0050] Among them, the relationship version information of the role relationship table is recorded in the database, and each time the role relationship table is updated (for example, adding, deleting, modifying, etc. operations on the role parent-child relationship), the relationship version information of the role relationship table is synchronously updated. Optionally, each time the role parent-child relationship dictionary is generated or updated, the dictionary version information corresponding to the role parent-child relationship dictionary is generated or updated, and the relationship version information corresponding to the dictionary version information is determined. Optionally, the relationship version information can be used as the dictionary version information. When the relationship version information stored in the memory is consistent with the dictionary version information recorded in the database, it is considered that the dictionary version information of the role parent-child relationship dictionary is consistent with the relationship version information of the role relationship table.

[0051] This solution updates the role parent-child relationship dictionary based on the dictionary version information of the role parent-child relationship dictionary and the relationship version information of the role relationship table when the role parent-child relationship dictionary is stored in the memory. While ensuring the accuracy of user authority determination, it effectively improves the efficiency of determining the role parent-child relationship dictionary and the efficiency of determining user authority.

[0052] In a possible embodiment, the user authority determination method provided by the present solution includes: when updating the role parent-child relationship dictionary based on the dictionary version information of the role parent-child relationship dictionary and the relationship version information of the role relationship table,

[0053] S2131: When the dictionary version information of the role parent-child relationship dictionary is inconsistent with the relationship version information of the role relationship table, determine first update information of the role relationship table.

[0054] S2132: Update the role parent-child relationship dictionary according to the first update information.

[0055] Exemplarily, when the dictionary version information of the role parent-child relationship dictionary is inconsistent with the relationship version information of the role relationship table, the relationship update information is requested from the database according to the relationship version information corresponding to the dictionary version information of the role parent-child relationship dictionary currently recorded in the memory, so as to obtain the first update information of the role relationship table from the database. The first update information records the updated content of the role relationship table corresponding to the current latest relationship version information relative to the role relationship table corresponding to the relationship version information corresponding to the dictionary version information of the role parent-child relationship dictionary currently recorded in the memory.

[0056] Furthermore, after determining the first update information of the role relationship table, the role parent-child relationship dictionary currently recorded in the memory is updated according to the update content indicated in the first update information, and the dictionary version information corresponding to the role parent-child relationship dictionary currently recorded in the memory is synchronously updated. By updating the role parent-child relationship dictionary with an outdated version according to the first update information of the role relationship table, this solution does not need to obtain the role parent-child relationship information of all users from the role relationship table every time the user authority is determined, thereby reducing the amount of data obtained from the role relationship table, improving the efficiency of determining the role parent-child relationship dictionary, and improving the efficiency of determining user authority.

[0057] In one embodiment, the user authority determination method provided by the present scheme, when determining the first update information of the role relationship table when the dictionary version information of the role parent-child relationship dictionary is inconsistent with the relationship version information of the role relationship table, includes: when the dictionary version information of the role parent-child relationship dictionary is inconsistent with the relationship version information of the role relationship table, determining whether the updated content of the role parent-child relationship dictionary includes the role parent-child relationship information corresponding to the target user; when the updated content of the role parent-child relationship dictionary includes the role parent-child relationship information corresponding to the target user, determining the first update information corresponding to the target user in the role relationship table.

[0058] Exemplarily, when the dictionary version information of the role parent-child relationship dictionary is inconsistent with the relationship version information of the role relationship table, the updated content of the latest role parent-child relationship dictionary relative to the previous role parent-child relationship dictionary is determined based on the relationship version information corresponding to the dictionary version information of the role parent-child relationship dictionary currently recorded in the memory, and it is determined whether the updated content includes the role parent-child relationship information corresponding to the target user.

[0059] When the updated content of the role parent-child relationship dictionary includes the role parent-child relationship information corresponding to the target user, the relationship update information is requested from the database according to the relationship version information corresponding to the dictionary version information of the role parent-child relationship dictionary currently recorded in the memory, so as to obtain the first update information of the role relationship table from the database. When the updated content of the role parent-child relationship dictionary does not include the role parent-child relationship information corresponding to the target user, the role parent-child relationship dictionary currently recorded in the memory can be directly used as the role parent-child relationship dictionary used by the current user authority determination process.

[0060] This solution updates the role parent-child relationship dictionary of an outdated version by using the first update information of the role relationship table when the update content of the role parent-child relationship dictionary includes the role parent-child relationship information corresponding to the target user, and directly uses the role parent-child relationship dictionary currently recorded in the memory as the role parent-child relationship dictionary used in the current user authority determination process when the update content of the role parent-child relationship dictionary does not include the role parent-child relationship information corresponding to the target user. There is no need to obtain the role parent-child relationship information of all users from the role relationship table every time the user authority is determined, which reduces the amount of data obtained from the role relationship table, improves the determination efficiency of the role parent-child relationship dictionary, and improves the efficiency of user authority determination.

[0061] S220: Obtain a role identification list of the target user from the authority control table, where the role identification list records the role identifications owned by the target user.

[0062] S230: Determine a role identification collection of the target user in the memory according to the role parent-child relationship dictionary and the role identification list, wherein the role identification collection records the role identifications owned by the target user and the inherited role identifications.

[0063] S240: Obtaining permission information corresponding to the roles owned by the target user and the inherited roles from the permission control table according to the collection of role identifiers.

[0064] S250: De-duplication processing is performed on the role identifiers of the target user and the permission information corresponding to the inherited roles.

[0065] Exemplarily, after obtaining the permission information corresponding to the roles owned by the target user and the inherited roles, the role identifiers owned by the target user and the permission information corresponding to the inherited roles are deduplicated to remove duplicate permission information and improve the quality of user permission determination.

[0066] In a possible embodiment, after obtaining the permission information corresponding to the roles and inherited roles owned by the target user from the permission control table according to the role identification collection, the user permission determination method provided by the present solution further includes:

[0067] S401: When a version update occurs in the role relationship table, second update information of the role relationship table is determined.

[0068] S402: updating the role parent-child relationship dictionary according to the second update information, and updating the role identifiers owned by the target user and the authority information corresponding to the inherited roles according to the updated role parent-child relationship dictionary.

[0069] Exemplarily, the version update of the role relationship table is monitored at a set time interval to determine whether a version update occurs in the role relationship table, or when the database updates the role relationship table, a first update event is fed back to the user authority determination device, and a version update occurs in the role relationship table based on the received first update event.

[0070] When a version update occurs in the role relationship table, the second update information of the role relationship table is determined. For example, the relationship update information is requested from the database according to the relationship version information corresponding to the dictionary version information of the role parent-child relationship dictionary currently recorded in the memory, so as to obtain the second update information of the role relationship table from the database. The second update information records the updated content of the role relationship table corresponding to the current latest relationship version information relative to the role relationship table corresponding to the relationship version information corresponding to the dictionary version information of the role parent-child relationship dictionary currently recorded in the memory.

[0071] Further, after determining the second update information of the role relationship table, the role parent-child relationship dictionary currently recorded in the memory is updated according to the update content indicated in the second update information, and the dictionary version information corresponding to the role parent-child relationship dictionary currently recorded in the memory is updated synchronously. After completing the update of the role parent-child relationship dictionary, the role identifier owned by the target user and the permission information corresponding to the inherited role are updated according to the updated role parent-child relationship dictionary. For example, the updated role parent-child relationship dictionary is used to re-acquire the permission information corresponding to the role owned by the target user and the inherited role from the permission control table, and the permission information corresponding to the role owned by the target user and the inherited role is overwritten and updated, thereby updating the user's permissions. This scheme updates the role parent-child relationship dictionary with an outdated version according to the second update information of the role relationship table when a version update occurs in the role relationship table, and updates the role identifier owned by the target user and the permission information corresponding to the inherited role according to the updated role parent-child relationship dictionary, thereby updating the user's permissions in a timely manner and improving the real-time and accuracy of user permission management.

[0072] In one embodiment, the user authority determination method provided by the present scheme, when updating the role parent-child relationship dictionary according to the second update information, includes: determining whether the updated content of the role parent-child relationship dictionary includes the role parent-child relationship information corresponding to the target user; when the updated content of the role parent-child relationship dictionary includes the role parent-child relationship information corresponding to the target user, determining the second update information corresponding to the target user in the role relationship table.

[0073] Exemplarily, when a version update occurs in the role relationship table, the updated content of the latest role parent-child relationship dictionary relative to the previous role parent-child relationship dictionary is determined based on the relationship version information corresponding to the dictionary version information of the role parent-child relationship dictionary currently recorded in the memory, and it is determined whether the updated content includes the role parent-child relationship information corresponding to the target user.

[0074] When the updated content of the role parent-child relationship dictionary includes the role parent-child relationship information corresponding to the target user, the relationship update information is requested from the database according to the relationship version information corresponding to the dictionary version information of the role parent-child relationship dictionary currently recorded in the memory, so as to obtain the second update information of the role relationship table from the database. When the updated content of the role parent-child relationship dictionary does not include the role parent-child relationship information corresponding to the target user, the role parent-child relationship dictionary may not be updated, and there is no need to update the role identifier owned by the target user and the authority information corresponding to the inherited role.

[0075] This solution updates the role parent-child relationship dictionary with an outdated version by using the second update information of the role relationship table when the update content of the role parent-child relationship dictionary includes the role parent-child relationship information corresponding to the target user, and does not update the role parent-child relationship dictionary when the update content of the role parent-child relationship dictionary does not include the role parent-child relationship information corresponding to the target user. There is no need to obtain the role parent-child relationship information of all users from the role relationship table every time the role parent-child relationship dictionary is updated, which reduces the amount of data obtained from the role relationship table, improves the efficiency of updating user permissions, and improves the real-time and accuracy of user permission management.

[0076] In a possible embodiment, after obtaining the permission information corresponding to the roles and inherited roles owned by the target user from the permission control table according to the role identification collection, the user permission determination method provided by the present solution further includes:

[0077] S501: When a permission update occurs in the permission control table, determining permission update information of the permission control table.

[0078] S502: updating the role identification list according to the permission update information, and updating the role identifications owned by the target user and the permission information corresponding to the inherited roles according to the updated role identification list.

[0079] The permission version information of the permission control table is recorded in the database, and each time the permission control table is updated (for example, adding, deleting, modifying, etc. the role identifiers and the permissions corresponding to the respective role identifiers), the permission version information of the permission control table is updated synchronously. Optionally, when determining the permission information corresponding to the roles and inherited roles owned by the target user, the permission control table corresponding to the permission information corresponding to the roles and inherited roles owned by the target user and / or the permission version information corresponding to the permission control table are synchronously recorded.

[0080] Exemplarily, the version update of the permission control table is monitored at a set time interval to determine whether a version update occurs in the permission control table, or when the database updates the permission control table, a second update event is fed back to the user permission determination device, and a version update of the permission control table is determined based on the received second update event.

[0081] When the permission control table is updated, the permission update information of the permission control table is determined, for example, the permission update information of the permission control table is obtained from the database. The permission update information records the updated content of the permission control table corresponding to the dictionary version information of the role identification list currently recorded in the memory.

[0082] Furthermore, after determining the permission update information of the permission control table, the role identification list is updated according to the update content indicated in the permission update information, and the dictionary version information corresponding to the role identification list currently recorded in the memory is updated synchronously. After completing the update of the role identification list, the permission information corresponding to the role identification owned by the target user and the inherited role is updated according to the updated role identification list. For example, the permission information corresponding to the role owned by the target user and the inherited role is obtained from the permission control table again using the updated role identification list, and the permission information corresponding to the role owned by the target user and the inherited role is overwritten and updated, thereby updating the user's permissions. This scheme updates the role identification list with an outdated version according to the permission update information of the permission control table when a version update occurs in the permission control table, and updates the permission information corresponding to the role identification owned by the target user and the inherited role according to the updated role identification list, thereby updating the user permissions in a timely manner and improving the real-time and accuracy of user permission management.

[0083] In the above, by obtaining the user's role parent-child relationship information from the role relationship table, and generating a role parent-child relationship dictionary in memory according to the role parent-child relationship information, obtaining the target user's role identification list from the permission control table, and determining the target user's role identification collection in memory according to the role parent-child relationship dictionary and the role identification list, obtaining the role owned by the target user and the corresponding permission information of the inherited role from the permission control table according to the role identification collection, effectively reducing the number of requests for data from the permission control table, reducing the lock and release operations on the permission control table, effectively shortening the time for obtaining user permissions, and improving the efficiency of obtaining user permissions. At the same time, the permission information corresponding to the role identification owned by the target user and the inherited role is deduplicated, and the duplicate permission information is removed to improve the quality of user permission determination. And when the role parent-child relationship dictionary is stored in the memory, the role parent-child relationship dictionary is updated based on the dictionary version information of the role parent-child relationship dictionary and the relationship version information of the role relationship table. While ensuring the accuracy of user permission determination, the determination efficiency of the role parent-child relationship dictionary is effectively improved, and the efficiency of user permission determination is improved.

[0084] Figure 3 A schematic diagram of the structure of a user authority determination device provided in an embodiment of the present application is given. Figure 3 The user authority determination device includes a relationship acquisition module 31, a role acquisition module 32, an identification acquisition module 33 and a authority determination module 34.

[0085] Among them, the relationship acquisition module 31 is used to obtain the user's role parent-child relationship information from the role relationship table, and generate a role parent-child relationship dictionary in the memory based on the role parent-child relationship information; the role acquisition module 32 is used to obtain the target user's role identification list from the permission control table, and the role identification list records the role identifications owned by the target user; the identification acquisition module 33 is used to determine the target user's role identification collection in the memory based on the role parent-child relationship dictionary and the role identification list, and the role identification collection records the role identifications owned by the target user and the inherited role identifications; the permission determination module 34 is used to obtain the permission information corresponding to the roles owned by the target user and the inherited roles from the permission control table based on the role identification collection.

[0086] In the above, by obtaining the user's role parent-child relationship information from the role relationship table, and generating a role parent-child relationship dictionary in memory based on the role parent-child relationship information, obtaining the target user's role identification list from the permission control table, and determining the target user's role identification collection in memory based on the role parent-child relationship dictionary and the role identification list, obtaining the role owned by the target user and the permission information corresponding to the inherited role from the permission control table based on the role identification collection, effectively reducing the number of times data is requested from the permission control table, reducing the locking and releasing operations on the permission control table, effectively shortening the time to obtain user permissions, and improving the efficiency of obtaining user permissions.

[0087] In a possible embodiment, when the relationship acquisition module 31 acquires the user's role parent-child relationship information from the role relationship table and generates a role parent-child relationship dictionary in the memory according to the role parent-child relationship information, it includes:

[0088] Determine whether the role parent-child relationship dictionary is saved in memory;

[0089] In the case that the role parent-child relationship dictionary is not stored in the memory, the role parent-child relationship information of the user is obtained from the role relationship table, and the role parent-child relationship dictionary is generated in the memory according to the role parent-child relationship information;

[0090] In the case where the role parent-child relationship dictionary is stored in the memory, the role parent-child relationship dictionary is updated based on the dictionary version information of the role parent-child relationship dictionary and the relationship version information of the role relationship table.

[0091] In a possible embodiment, when the relationship acquisition module 31 updates the role parent-child relationship dictionary based on the dictionary version information of the role parent-child relationship dictionary and the relationship version information of the role relationship table, it includes:

[0092] When the dictionary version information of the role parent-child relationship dictionary is inconsistent with the relationship version information of the role relationship table, determining first update information of the role relationship table;

[0093] The role parent-child relationship dictionary is updated according to the first update information.

[0094] In a possible embodiment, when the dictionary version information of the role parent-child relationship dictionary is inconsistent with the relationship version information of the role relationship table, the relationship acquisition module 31 determines the first update information of the role relationship table, including:

[0095] When the dictionary version information of the role parent-child relationship dictionary is inconsistent with the relationship version information of the role relationship table, determining whether the updated content of the role parent-child relationship dictionary includes the role parent-child relationship information corresponding to the target user;

[0096] When the update content of the role parent-child relationship dictionary includes the role parent-child relationship information corresponding to the target user, first update information corresponding to the target user in the role relationship table is determined.

[0097] In a possible embodiment, the user authority determination device further includes a first update response module and a first update processing module.

[0098] The first update response module is used to determine the second update information of the role relationship table when a version update occurs in the role relationship table;

[0099] The first update processing module is used to update the role parent-child relationship dictionary according to the second update information, and update the role identifier owned by the target user and the permission information corresponding to the inherited role according to the updated role parent-child relationship dictionary.

[0100] In a possible embodiment, the user authority determination device further includes a second update response module and a second update processing module.

[0101] Wherein, the second update response module is used to determine the permission update information of the permission control table when the permission update occurs in the permission control table;

[0102] The second update processing module is used to update the role identification list according to the permission update information, and update the role identifications owned by the target user and the permission information corresponding to the inherited roles according to the updated role identification list.

[0103] In a possible embodiment, the user authority determination device further includes a deduplication processing module, which is used to perform deduplication processing on the role identifications possessed by the target user and the authority information corresponding to the inherited roles.

[0104] It is worth noting that in the embodiment of the above-mentioned user authority determination device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present application.

[0105] The embodiment of the present application also provides a user authority determination device, which can integrate the user authority determination apparatus provided in the embodiment of the present application. Figure 4 Schematic diagram of a user authority determination device provided in an embodiment of the present application. Figure 4The user authority determination device includes: an input device 43, an output device 44, a memory 42 and one or more processors 41; the memory 42 is used to store one or more programs; when one or more programs are executed by one or more processors 41, the one or more processors 41 implement the user authority determination method provided in the above embodiment. The input device 43, the output device 44, the memory 42 and the processor 41 can be connected by a bus or other means. Figure 4 The example of connecting through bus is taken in the following.

[0106] The memory 42, as a computing device readable storage medium, can be used to store software programs, computer executable programs and modules, such as the program instructions / modules corresponding to the user authority determination method provided in any embodiment of the present application (for example, the relationship acquisition module 31, the role acquisition module 32, the identification acquisition module 33 and the authority determination module 34 in the user authority determination device). The memory 42 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the device, etc. In addition, the memory 42 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 42 may further include a memory remotely arranged relative to the processor 41, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0107] The input device 43 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 44 may include a display device such as a display screen.

[0108] The processor 41 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 42, that is, implements the above-mentioned user authority determination method.

[0109] The user authority determination apparatus, device and computer provided above can be used to execute the user authority determination method provided in any of the above embodiments, and have corresponding functions and beneficial effects.

[0110] An embodiment of the present application also provides a storage medium storing computer executable instructions. When the above computer executable instructions are executed by a computer processor, they are used to execute the user authority determination method provided in the above embodiment. The user authority determination method includes: obtaining the user's role parent-child relationship information from the role relationship table, and generating a role parent-child relationship dictionary in the memory based on the role parent-child relationship information; obtaining the target user's role identification list from the authority control table, the role identification list records the role identifications owned by the target user; according to the role parent-child relationship dictionary and the role identification list, determining the target user's role identification collection in the memory, the role identification collection records the role identifications owned by the target user and the inherited role identifications; according to the role identification collection, obtaining the authority information corresponding to the roles owned by the target user and the inherited roles from the authority control table.

[0111] Storage medium - any of various types of memory devices or storage devices. The term "storage medium" is intended to include: installation media, such as CD-ROM, floppy disk or tape device; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (such as hard disk or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. In addition, the storage medium may be located in the first computer system in which the program is executed, or may be located in a different second computer system, which is connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media that may reside in different locations (for example, in different computer systems connected by a network). The storage medium may store program instructions (for example, embodied as a computer program) that can be executed by one or more processors.

[0112] Of course, the computer executable instructions of a storage medium storing computer executable instructions provided in an embodiment of the present application are not limited to the user authority determination method provided above, and can also execute related operations in the user authority determination method provided in any embodiment of the present application.

[0113] The user authority determination apparatus, device, and storage medium provided in the above embodiments can execute the user authority determination method provided in any embodiment of the present application. For technical details not described in detail in the above embodiments, refer to the user authority determination method provided in any embodiment of the present application.

[0114] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments provided herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.

Claims

1. A method for determining user authority, characterized in that: include: Obtaining the user's role parent-child relationship information from the role relationship table, and generating a role parent-child relationship dictionary in memory according to the role parent-child relationship information; Obtaining a role identification list of the target user from the authority control table, wherein the role identification list records the role identifications directly owned by the target user, and the authority control table is recorded in a set database; According to the role parent-child relationship dictionary and the role identifier list, determining the role identifier collection of the target user in the memory, wherein the role identifier collection records the role identifiers owned by the target user and the inherited role identifiers; Acquire the permission information corresponding to the roles and inherited roles owned by the target user from the permission control table according to the collection of role identifiers; In the case where a version update occurs in the role relationship table, determining second update information of the role relationship table; The role parent-child relationship dictionary is updated according to the second update information, and the role identifier owned by the target user and the permission information corresponding to the inherited role are updated according to the updated role parent-child relationship dictionary; In the case where a permission update occurs in the permission control table, determining permission update information of the permission control table; The role identification list is updated according to the permission update information, and the role identifications owned by the target user and the permission information corresponding to the inherited roles are updated according to the updated role identification list.

2. The user authority determination method according to claim 1, characterized in that: The step of obtaining the user's role parent-child relationship information from the role relationship table and generating a role parent-child relationship dictionary in the memory according to the role parent-child relationship information includes: Determine whether the role parent-child relationship dictionary is saved in memory; If the role parent-child relationship dictionary is not stored in the memory, obtaining the user's role parent-child relationship information from the role relationship table, and generating the role parent-child relationship dictionary in the memory according to the role parent-child relationship information; In the case where the role parent-child relationship dictionary is stored in the memory, the role parent-child relationship dictionary is updated based on the dictionary version information of the role parent-child relationship dictionary and the relationship version information of the role relationship table.

3. The user authority determination method according to claim 2, characterized in that: The updating of the role parent-child relationship dictionary based on the dictionary version information of the role parent-child relationship dictionary and the relationship version information of the role relationship table includes: In the case where the dictionary version information of the role parent-child relationship dictionary is inconsistent with the relationship version information of the role relationship table, determining first update information of the role relationship table; The role parent-child relationship dictionary is updated according to the first update information.

4. The method for determining user rights according to claim 3, characterized in that: When the dictionary version information of the role parent-child relationship dictionary is inconsistent with the relationship version information of the role relationship table, determining the first update information of the role relationship table includes: In the case where the dictionary version information of the role parent-child relationship dictionary is inconsistent with the relationship version information of the role relationship table, determining whether the updated content of the role parent-child relationship dictionary includes the role parent-child relationship information corresponding to the target user; In a case where the updated content of the role parent-child relationship dictionary includes the role parent-child relationship information corresponding to the target user, first update information corresponding to the target user in the role relationship table is determined.

5. The method for determining user rights according to any one of claims 1 to 4, characterized in that: After obtaining the permission information corresponding to the roles and inherited roles owned by the target user from the permission control table according to the set of role identifiers, the method further includes: Deduplication is performed on the role identifiers of the target user and the permission information corresponding to the inherited roles.

6. A user authority determination device, characterized in that: It includes a relationship acquisition module, a role acquisition module, an identification acquisition module, an authority determination module, a first update response module, a first update processing module, a second update response module and a second update processing module, wherein: The relationship acquisition module is used to acquire the user's role parent-child relationship information from the role relationship table, and generate a role parent-child relationship dictionary in the memory according to the role parent-child relationship information; The role acquisition module is used to acquire a role identification list of the target user from the authority control table, wherein the role identification list records the role identifications directly owned by the target user, and the authority control table is recorded in a set database; The identification acquisition module is used to determine the role identification collection of the target user in the memory according to the role parent-child relationship dictionary and the role identification list, wherein the role identification collection records the role identifications owned by the target user and the inherited role identifications; The permission determination module is used to obtain permission information corresponding to the roles and inherited roles owned by the target user from the permission control table according to the set of role identifiers; The first update response module is used to determine the second update information of the role relationship table when a version update occurs in the role relationship table; the first update processing module is used to update the role parent-child relationship dictionary according to the second update information, and update the role identifier owned by the target user and the permission information corresponding to the inherited role according to the updated role parent-child relationship dictionary; The second update response module is used to determine the permission update information of the permission control table when a permission update occurs in the permission control table; the second update processing module is used to update the role identification list according to the permission update information, and update the role identification owned by the target user and the permission information corresponding to the inherited role according to the updated role identification list.

7. A user authority determination device, characterized in that: include: memory and one or more processors; The memory is used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the user authority determination method as described in any one of claims 1 to 5.

8. A storage medium storing computer executable instructions, characterized in that: The computer executable instructions are used to execute the user authority determination method according to any one of claims 1 to 5 when executed by a computer processor.