Access control methods, devices, electronic devices and computer-readable storage media
By displaying the reference directory of the current level based on user permission information, and by combining Redis and Web caching to optimize permission management, the problems of high system processing pressure and slow page display have been solved, thereby improving user experience and system security.
Patent Information
- Application Number
- CN202310667306.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-06
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2043-06-06
AI Technical Summary
Existing access control technologies suffer from high system processing load and slow page display speed. Users need to click a button to confirm permissions, which increases operation time and system burden.
By displaying the reference directory of the current level based on user permission information, permission verification is reduced. Permission information is stored using Redis and Web caching, and is only displayed on directories and controls with the required permissions. Combined with update identifier management of cached data, permission information query and display are optimized.
It reduced system processing load, improved page display speed and user experience, simplified permission management workload, and enhanced system security and information retrieval speed.
Smart Images

Figure CN116595047B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of access control technology, and more specifically, to an access control method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] In some management systems, administrators assign permissions to ordinary users. Different types of ordinary users have different permissions, and the operations they can perform on the system are also very different.
[0003] In related permission management technologies, all users see the same page. Permission checks are added to each button interface to ensure that only users with the corresponding permissions can use the button. However, users only know whether they have the permission to perform the corresponding operation when they click the button and the operation fails or the button responds. This greatly wastes users' operation time. Furthermore, adding permission checks to each button interface also greatly increases the system's processing load. Therefore, related technologies suffer from problems such as high system processing load and slow page display speed. Summary of the Invention
[0004] This application provides a permission management method, apparatus, electronic device, and computer-readable storage medium, which can solve the problems of high system processing pressure and slow system page display speed in permission management technology.
[0005] According to a first aspect of the embodiments of this application, a method for access control is provided, the method comprising:
[0006] Display the reference directory of the current level of the preset business system. The reference directory of the current level is matched with the user's permission information. The permission information is used to indicate the directory identifier of at least two levels of reference directories. The number of reference directories at each level is at least one. The reference directories are the directories that the user has operation permissions in the preset business system. Each reference directory is used to display the corresponding target information when it is triggered.
[0007] In response to a trigger operation on a target directory in the reference directory of the current level, the target information corresponding to the target directory is determined and displayed from the permission information pre-stored in the first storage area;
[0008] The target information corresponding to the lowest-level reference directory includes at least one corresponding operation control, and the target information corresponding to the reference directories of other levels includes at least one reference directory of the next level.
[0009] In one possible implementation, the response module of the access control device includes:
[0010] The first response unit is configured to respond to a trigger operation targeting a target directory in the reference directory of the current level, if it is determined that the Redis cache does not store the permission information;
[0011] The first display unit is used to determine and display the target information corresponding to the target directory from the permission information stored in the first storage area, and to store the sub-permission information of the target directory in the Web cache.
[0012] The first storage area is the Redis cache or the database, and when the first storage area is the Redis cache, before displaying the target information corresponding to the target directory, the method further includes: storing the permission information pre-stored in the database into the Redis cache;
[0013] When the first storage area is the database, the method further includes: storing the permission information pre-stored in the database into a Redis cache;
[0014] Wherein, when the target directory is the lowest level reference directory, the sub-permission information of the target directory is used to indicate the control identifier of at least one corresponding operation control; when the target directory is not the lowest level reference directory, the sub-permission information of the target directory is used to indicate the directory identifier of at least one next-level reference directory.
[0015] In another possible implementation of the target information, the response module of the access control device includes:
[0016] The second caching unit is used to respond to a trigger operation on a target directory in the reference directory of the current level. If it is determined that the Web cache does not store the sub-permission information of the target directory and the Redis cache has stored the permission information, then the Redis cache is used as the first storage area.
[0017] The second display unit is used to determine and display the target information corresponding to the target directory from the permission information stored in the first storage area, and to store the sub-permission information of the target directory in the Web cache;
[0018] Wherein, when the target directory is the lowest level reference directory, the sub-permission information of the target directory is used to indicate the control identifier of at least one corresponding operation control; when the target directory is not the lowest level reference directory, the sub-permission information of the target directory is used to indicate the directory identifier of at least one next-level reference directory.
[0019] In yet another possible implementation, the access control device also includes:
[0020] The deletion module is used to delete the permission information stored in the Redis cache when the permission information stored in the database is updated;
[0021] The update module updates the update identifier of the permission information, wherein the update identifier is used to indicate the number of times the permission information in the Redis cache has been updated;
[0022] A caching module is used to store the sub-permission information of the target directory and the update identifier of the permission information into the Web cache;
[0023] The first determination module is configured to, if it is determined that the update identifier of the permission information stored in the Web cache is inconsistent with the update identifier of the permission information stored in the Redis cache, then use the Redis cache as the first storage area; determine and display the target information corresponding to the target directory from the permission information stored in the first storage area; and replace the sub-permission information of the target directory stored in the Web cache with the sub-permission information of the target directory stored in the Redis cache.
[0024] If it is determined that the update identifier of the permission information stored in the Web cache is consistent with the update identifier of the permission information stored in the Redis cache, then the Web cache is used as the first storage area;
[0025] The target information corresponding to the target directory is determined and displayed from the permission information stored in the first storage area.
[0026] In another possible implementation, in response to the user's first login operation to the preset business system, the user's permission information is obtained from the database and stored in the Redis cache; the top-level reference directory is displayed according to the permission information stored in the Redis cache, and the permission information of the top-level reference directory is stored in the web cache.
[0027] In response to the user's first trigger operation targeting the target directory in the reference directory, the sub-permission information of the target directory is obtained from the Redis cache, the target information corresponding to the target directory is displayed based on the sub-permission information of the target directory, and the sub-permission information of the target directory is stored in the Web cache;
[0028] Wherein, when the target directory is the lowest level reference directory, the sub-permission information of the target directory is used to indicate the control identifier of at least one corresponding operation control; when the target directory is not the lowest level reference directory, the sub-permission information of the target directory is used to indicate the directory identifier of at least one next-level reference directory.
[0029] In yet another possible implementation, the directory identifier of the next-level reference directory corresponding to the target directory includes the directory identifier of the target directory;
[0030] The control identifier of the operation control corresponding to the target directory includes the identifier of the target directory.
[0031] In yet another possible implementation, the access control device also includes:
[0032] The logout module is used to log the user out of the preset business system in response to modifications to the user's permission information when the user is using the preset business system.
[0033] According to a second aspect of the embodiments of this application, a permission management device is provided, the device comprising:
[0034] Display the reference directory of the current level of the preset business system. The reference directory of the current level is matched with the user's permission information. The permission information is used to indicate the directory identifier of at least two levels of reference directories. The number of reference directories at each level is at least one. The reference directories are the directories that the user has operation permissions in the preset business system. Each reference directory is used to display the corresponding target information when it is triggered.
[0035] In response to a trigger operation on a target directory in the reference directory of the current level, the target information corresponding to the target directory is determined and displayed from the permission information pre-stored in the first storage area;
[0036] The target information corresponding to the lowest-level reference directory includes at least one corresponding operation control, and the target information corresponding to the reference directories of other levels includes at least one reference directory of the next level.
[0037] According to a third aspect of the embodiments of this application, an electronic device is provided, the electronic device including a memory, a processor and a computer program stored in the memory, wherein the processor executes the program to implement the steps of the permission management method provided in the first aspect.
[0038] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the permission management method provided in the first aspect.
[0039] According to a fifth aspect of the present application, a computer program product is provided, the computer program product including computer instructions stored in a computer-readable storage medium, wherein when a processor of a computer device reads the computer instructions from the computer-readable storage medium, the processor executes the computer instructions, causing the computer device to perform steps implementing the access control method provided in the first aspect.
[0040] The beneficial effects of the technical solutions provided in this application are:
[0041] The permission management method provided in this application displays reference directories with operation permissions at the current level using the user's permission information. This eliminates the need for permission checks on each directory or control, and only displays reference directories and operation controls with permission information within the preset business system. This avoids inconsistent display across all system pages, where users need to perform a trigger operation to determine if they have the necessary permissions. This saves users time in the preset business system, improving user experience. Furthermore, eliminating the need for permission checks on each directory and control significantly reduces system processing load. When a user triggers a target directory, only the permission information corresponding to the target directory is retrieved from the first storage area, avoiding the retrieval of useless permission information, improving the speed of permission information retrieval, and increasing the speed of displaying target information in the business system, thus reducing user waiting time. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.
[0043] Figure 1 This is a schematic diagram of the system architecture for implementing the permission management method provided in the embodiments of this application;
[0044] Figure 2 A flowchart illustrating a permission management method provided in an embodiment of this application;
[0045] Figure 3 A schematic diagram of a preset business system page that triggers the lowest-level reference directory, as provided in an embodiment of this application;
[0046] Figure 4 A schematic diagram of a preset business system after triggering a non-lowest-level reference directory, provided as an embodiment of this application;
[0047] Figure 5 This is a schematic diagram of the structure of a permission management device provided in an embodiment of this application;
[0048] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0049] The embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions of the embodiments of this application.
[0050] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this application mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term; for example, “A and / or B” can be implemented as “A,” or as “B,” or as “A and B.”
[0051] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0052] First, let's introduce and explain several terms used in this application:
[0053] Redis: Redis is a key-value store. Similar to Memcached, it supports a wider range of value types, including string, list, set, sorted set (zset), and hash. These data types support push / pop, add / remove, intersection, union, difference, and more complex operations, all of which are atomic. Furthermore, Redis supports various sorting methods. Like Memcached, data is cached in memory for efficiency. The difference is that Redis periodically writes updated data to disk or appends modification operations to a log file, and it also implements master-slave synchronization.
[0054] Web caching: Web caching (or HTTP caching) is an information technology used to temporarily store (cache) web documents (such as HTML pages and images) to reduce server latency. A web caching system saves a copy of the document that passes through it; subsequent requests can be satisfied by the cache if certain conditions are met. A web caching system can refer to either a device or a computer program.
[0055] The rights management methods, devices, electronic devices, computer-readable storage media, and computer program products provided in this application are intended to solve the above-mentioned technical problems of the prior art.
[0056] The technical solutions of this application and their effects are described below through several exemplary embodiments. It should be noted that the following embodiments can be referenced, borrowed from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.
[0057] Figure 1 This is a schematic diagram of the system architecture for implementing the permission management method provided in this application embodiment. The system architecture includes: a terminal 120 and a server 140.
[0058] Terminal 120 installs and runs an application that supports permission management methods. Terminal 120 is used to display preset pages of preset business systems based on the user's permission information.
[0059] Terminal 120 is connected to server 140 via a wireless network or a wired network.
[0060] Server 140 includes at least one of a cloud computing platform and a virtualization center. Illustratively, server 140 includes a processor 144 and a memory 142, the memory 142 including a display module 1421, a control module 1422, and a receiving module 1423. Server 140 is used to provide background services for applications supporting access control methods. Optionally, server 140 performs the primary computing task, and terminal 120 performs secondary computing tasks; or, server 140 performs secondary computing tasks, and terminal 120 performs primary computing tasks; or, server 140 and terminal 120 collaborate in a distributed computing architecture.
[0061] Optionally, the device type of the terminal includes at least one of the following: POS terminal, smartphone, tablet computer, e-book reader, Moving Picture Experts Group Audio Layer III (MP3) player, Moving Picture Experts Group Audio Layer IV (MP4) player, laptop computer, and desktop computer.
[0062] Those skilled in the art will understand that the number of terminals described above can be more or less. For example, there may be only one terminal, or there may be dozens or hundreds of terminals, or even more. This application does not limit the number of terminals or the type of device.
[0063] To overcome the aforementioned problems of the prior art, this application provides a permission management method applied to a terminal, which can be one of the above-mentioned methods. Figure 1 Terminal 120 in the middle, such as Figure 2 As shown, the method includes:
[0064] S101, Display the reference directory of the current level of the preset business system. The reference directory of the current level matches the user's permission information. The permission information is used to indicate the directory identifier of at least two levels of reference directories. There is at least one reference directory at each level. The reference directory is the directory that the user has operation permissions in the preset business system. Each reference directory is used to display the corresponding target information when it is triggered.
[0065] In this application embodiment, the preset business system is a system with multiple user control permissions. For example, in the same system, the functions that can be used and the content that can be viewed in the preset business system are different due to the different permissions that users have. It should be noted that this application embodiment does not specifically limit the preset business system, but determines the preset business system according to the actual situation and application scenario.
[0066] In this embodiment, the preset business system includes at least two levels of reference directories, with each level having at least one reference directory. A reference directory refers to a directory where the user has operational permissions within the preset business system; that is, a reference directory that the user can see and execute trigger operations on. After executing a trigger operation on a reference directory, the user will receive corresponding target information. The reference directories displayed at the current level in the preset business system can be any one or more reference directories from any level.
[0067] In this embodiment of the application, the permission information includes directory identifiers of at least two levels of reference directories. Each reference directory has a corresponding directory identifier. The permission information is composed of the directory identifiers of the reference directories at each level. Thus, the permission information can be used to know the reference directories in which the user has operation permissions at each level of the preset business system. Therefore, the reference directories at the current level that match the permission information can be displayed in the preset business system.
[0068] By obtaining reference directories with operation permissions through permission information, there is no need to add permission verification to every directory in the business system, which greatly reduces the processing pressure of the system when operating the preset business system. At the same time, it is not necessary to determine whether the currently triggered directory is a directory with operation permissions after the user triggers the directory, avoiding the time wasted by the user clicking on directories without permission when using the system, and greatly improving the user experience.
[0069] In one possible implementation, in response to a user's first login operation to a preset business system, the user's permission information is retrieved from the database and stored in a Redis cache; the top-level reference directory is displayed based on the permission information stored in the Redis cache, and the permission information of the top-level reference directory is stored in a web cache; in response to a user's first trigger operation targeting a target directory within the reference directory, the sub-permission information of the target directory is retrieved from the Redis cache, the target information corresponding to the target directory is displayed based on the sub-permission information of the target directory, and the sub-permission information of the target directory is stored in a web cache.
[0070] Specifically, when the target directory is the lowest-level reference directory, the sub-permission information of the target directory is used to indicate the control identifier of at least one corresponding operation control; when the target directory is not the lowest-level reference directory, the sub-permission information of the target directory is used to indicate the directory identifier of at least one next-level reference directory.
[0071] In this embodiment, the Redis cache is located on the system's backend server, allowing for fast query speeds when users retrieve cached information; the web cache is located in the user's browser, enabling rapid rendering of the user's browsing page, reducing page response time, and improving user experience.
[0072] In this embodiment, after the administrator assigns permission information to each user in the preset business system through the management system, the system automatically stores the permission information associated with each user in the database. When a user logs into the preset business system for the first time, the system queries the database for the pre-stored permission information associated with the user based on the user's identity ID or identity identifier data, retrieves the user's permission information, and stores the permission information in a Redis cache. Based on the permission information in the Redis cache, the system displays the highest-level reference directory of the preset business system. Simultaneously, the permission information of the highest-level reference directory is saved in the web cache so that the user can directly retrieve the permission information of the highest-level reference directory from the web cache the next time they log into the preset business system. When a user logs into the preset business system for the first time, no judgment operation is required; the system directly retrieves the user's permission information from the database and stores it in the Redis cache, and stores the permission information of the highest-level reference directory in the web cache. The next time the user logs in, the system directly retrieves the permission information from the user's browser's web cache, reducing the system's processing load.
[0073] In this embodiment, when a user logs into the system for the first time, all reference directories at each level are in an untriggered state. Therefore, when the target directory of any reference directory at any level is triggered by the user for the first time, the sub-permission information of the target directory is retrieved from the Redis cache. Based on the sub-permission information of the target directory, the target information corresponding to the target directory is displayed. The sub-permission information of the target directory is also stored in the user's browser's web cache. The next time the user clicks on the target directory, the corresponding target information can be directly displayed based on the sub-permission information stored in the web cache, without needing to retrieve it from the Redis cache. This results in faster target information display and significantly improves the user experience.
[0074] In one possible implementation, the directory identifier of the next-level reference directory corresponding to the target directory includes the directory identifier of the target directory; the control identifier of the operation control corresponding to the target directory includes the identifier of the target directory.
[0075] In this embodiment of the application, since the next level reference directory has its corresponding previous level reference directory, the identifier of the next level reference directory or control is set based on the directory of the previous level reference directory.
[0076] In one example, the pre-defined business system has a total of two levels of reference directories. The first-level reference directory A corresponds to the second-level reference directories A1, A2, and A3. The operation controls corresponding to reference directory A1 are operation controls a1 and a2. The first-level reference directories are assigned unique directory identifiers with numbers from "1-99" in sequence. Reference directory A is assigned directory identifier 10. Based on the directory identifier 10 of reference directory A, reference directories A1, A2, and A3 are assigned 1001, 1002, and 1003 as directory identifiers, respectively. Based on the directory identifier 1001 of reference directory A1, the corresponding operation controls a1 and a2 are assigned 100101 and 100102 as control identifiers, respectively.
[0077] It should be noted that the embodiments of this application do not specifically limit the directory identifier and control identifier. The control identifier and directory identifier can be numbers, letters, or characters. The specific settings of the control identifier and directory identifier are determined according to the specific application scenario and actual situation.
[0078] By using directory identifiers and control identifiers to represent objects with operation permissions in the preset business system, users can directly modify permission information by using directory identifiers and control identifiers when they need to add, delete, or update permission information. This makes the expansion of permission control simpler and more convenient, saving the workload and cost of permission management.
[0079] S102, in response to a trigger operation on a target directory in the reference directory of the current level, determine and display the target information corresponding to the target directory from the permission information pre-stored in the first storage area.
[0080] The target information corresponding to the lowest-level reference directory includes at least one corresponding operation control, and the target information corresponding to the reference directories of other levels includes at least one reference directory of the next level.
[0081] In one example, in response to a reference directory at the lowest level, at least one operation control corresponding to the reference directory is displayed. Here, the operation controls in the preset business system refer to controls with specific functions on the page of the preset business system, such as delete, add, and modify controls. (Reference) Figure 3The example illustrates a schematic diagram of a preset business system page after the lowest-level reference directory is triggered. For instance, the next-level reference directories a302 and b303 corresponding to reference directory A301 are the lowest-level reference directories. The operation controls corresponding to reference directory a302 are operation controls a304, b305, and c306. In response to the user triggering reference directory a302, operation controls a304, b305, and c306 are displayed on the preset business system page. It should be noted that this application embodiment does not specifically limit the operation controls in the preset business system; the operation controls are determined based on the application scenario and actual situation of the preset business system.
[0082] In yet another example, in response to a reference directory that triggers a non-lowest-level reference directory, at least one next-level reference directory corresponding to the reference directory is displayed. Figure 4 The example shows a schematic diagram of the preset business system's page after triggering a non-lowest-level reference directory, such as... Figure 4 As shown, for example, reference directories A401, B402, and C403 are not the lowest level directories. The next level reference directories corresponding to reference directory B402 are reference directories a404 and b405. In response to the user triggering reference directory B402, reference directories a404 and b405 are displayed in the preset business system page.
[0083] This application provides a possible implementation method in response to a trigger operation on a target directory in the reference directory of the current level, if it is determined that the Redis cache does not store permission information;
[0084] From the permission information stored in the first storage area, determine and display the target information corresponding to the target directory, and store the sub-permission information of the target directory in the Web cache; the first storage area is a Redis cache or a database, and when the first storage area is a Redis cache, before displaying the target information corresponding to the target directory, the method further includes: storing the permission information pre-stored in the database in the Redis cache; when the first storage area is a database, storing the permission information pre-stored in the database in the Redis cache.
[0085] Specifically, when the target directory is the lowest-level reference directory, the sub-permission information of the target directory is used to indicate the control identifier of at least one corresponding operation control; when the target directory is not the lowest-level reference directory, the sub-permission information of the target directory is used to indicate the directory identifier of at least one next-level reference directory.
[0086] In this embodiment of the application, if the permission information is not stored in the Redis cache, the permission information needs to be obtained from the database. The target information of the triggered target directory is then displayed based on the permission information. When displaying the target information of the target directory using the permission information, the permission information obtained from the database can be used directly, or the user's permission information can be stored in the Redis cache, and the sub-permission information of the target directory can be obtained from the Redis cache for display.
[0087] In one example, in response to a user's trigger operation on a target directory within the current level of the reference directory, the system first checks if permission information exists in the Redis cache. If not, it stores the user's pre-stored permission information from the database into the Redis cache. In other words, it stores the identifiers of all reference directories and operation controls that the user has permission to access. Using the Redis cache as the primary storage area, the system retrieves permission information from the Redis cache to determine at least one next-level reference directory or at least one corresponding operation control within the target directory. This information is then displayed in the pre-defined business system as the reference directories or operation controls that the user has permission to access.
[0088] In this embodiment, after displaying the next-level reference directory or the corresponding operation control corresponding to the target directory in the preset business system, the directory identifier of the next-level reference directory or the control identifier of the corresponding operation control is stored as sub-permission information in the Web cache. That is, only the directory identifier of the next-level reference directory or the control identifier of the corresponding operation control is stored in the Web cache, and all user permission information is not stored at once. In other words, in this embodiment, the sub-permission information corresponding to the target directory is only stored in the Web cache after the target directory is triggered. For reference directories that have not been triggered, the Web cache will not store the corresponding sub-permission information.
[0089] The absence of permission information in the Redis cache indicates that the user is logging into the default business system for the first time, or that the permission information in the database has changed. It is necessary to save the newly updated permission information in the database to the Redis cache to avoid using the old permission information and causing important system data to be leaked to unauthorized users.
[0090] In this embodiment, the user's permission information is only queried from the database when it is not stored in the Redis cache. The retrieved permission information is then stored in the Redis cache for subsequent triggering operations on the reference directory. Since the permission information in the database remains unchanged, only one database query is performed, reducing database query pressure. Furthermore, caching permission information in the Redis cache makes system processing faster. When retrieving permission information from the Redis cache, only the directory identifier of the next-level reference directory or the directory identifier of the corresponding operation control is retrieved, further reducing query pressure and time spent retrieving permission information, enabling the retrieved content to be quickly displayed to the user.
[0091] In another example, in response to a trigger operation on a target directory within the current level of the reference directory, if the user's permission information is not stored in the Redis cache, the user's permission information is retrieved from the database. The next level of the reference directory or operation controls corresponding to the target directory are then displayed directly based on this information, reducing system processing time and promptly displaying the preset business system's page. Furthermore, the retrieved user permission information is stored in the Redis cache so that it can be retrieved directly for subsequent trigger operations, reducing system processing pressure. Simultaneously, the sub-permission information of the target directory is stored in the Web cache so that when the user triggers the target directory again, the corresponding target information can be displayed directly based on the cached sub-permission information, further reducing system processing pressure and improving system response speed.
[0092] This application provides a possible implementation method: in response to a trigger operation on a target directory in the reference directory of the current level, if it is determined that the Web cache does not store the sub-permission information of the target directory and the Redis cache has stored the permission information, then the Redis cache is used as the first storage area; the target information corresponding to the target directory is determined and displayed from the permission information stored in the first storage area, and the sub-permission information of the target directory is stored in the Web cache.
[0093] In this embodiment of the application, if the user's permission information is already stored in the Redis cache and the sub-permission information of the target directory is not stored in the Web cache, the directory identifier of the next level reference directory corresponding to the target directory or the control identifier of the corresponding operation control is directly obtained from the Redis cache, and the corresponding reference directory or operation control is displayed in the preset business system based on the obtained at least one directory identifier or control identifier.
[0094] In one example, user A's permission information includes: directory identifiers 10 and 20 for the first-level reference directories A and B, directory identifiers 1001 and 1002 for the second-level reference directories A1 and A2 corresponding to reference directory A, and control identifiers 100101 and 100102 for operation control 1 and operation control 2 corresponding to reference directory A1.
[0095] In response to user A's trigger operation on reference directory A, it is detected that user A's permission information is not stored in the Redis cache. Therefore, the permission information of user A pre-stored in the database is stored in the Redis cache. The directory identifiers 1001 and 1002 of the reference directories A1 and A2 corresponding to reference directory A are retrieved from the Redis cache. Based on 1001 and 1002, the corresponding reference directories A1 and A2 are displayed in the preset business system. The directory identifiers 1001 and 1002 of A1 and A2 are stored in the Web cache, that is, the sub-permission information of reference directory A is stored in the Web cache.
[0096] In response to user A's trigger operation on reference directory A1, it is detected that user A's permission information is stored in the Redis cache, but the sub-permission information of reference directory A1 is not stored in the Web cache. Therefore, the control identifiers 100101 and 100102 of operation control 1 and operation control 2 corresponding to reference directory A1 are retrieved from the Redis cache. Based on the control identifiers 100101 and 100102, the corresponding operation control 1 and operation control 2 are displayed in the preset business system, and the control identifiers 100101 and 100102 of operation control 1 and operation control 2 are stored in the Web cache.
[0097] This application provides a possible implementation method: when the permission information stored in the database is updated, the permission information stored in the Redis cache is deleted; the permission information pre-stored in the database is stored in the Redis cache, and the update identifier of the permission information is updated. The update identifier is used to represent the number of times the permission information in the Redis cache has been updated; the sub-permission information of the target directory and the update identifier of the permission information are stored in the Web cache; if it is determined that the update identifier of the permission information stored in the Web cache is inconsistent with the update identifier of the permission information stored in the Redis cache, then the Redis cache is used as the first storage area; the target information corresponding to the target directory is determined and displayed from the permission information stored in the first storage area, and the sub-permission information of the target directory stored in the Web cache is replaced with the sub-permission information of the target directory stored in the Redis cache; if it is determined that the update identifier of the permission information stored in the Web cache is consistent with the update identifier of the permission information stored in the Redis cache, then the Web cache is used as the first storage area; the target information corresponding to the target directory is determined and displayed from the permission information stored in the first storage area.
[0098] In this embodiment of the application, as user permissions change, the user permission information stored in the database will also change. When the user permission information in the database is updated, the user permission information stored in the Redis cache is cleared. The next time the user logs into the system, the updated permission information in the database is stored in the Redis cache, and the update flag in the Redis cache that represents the number of times the permission information in the Redis cache has been updated is updated.
[0099] In this embodiment of the application, after storing the sub-permission information of the reference directory in the Web cache each time, the update identifier in the Redis cache is stored in the Web cache to record which number the permission information stored in the current Web cache has been updated.
[0100] In this embodiment, in response to a trigger operation on a reference directory, it is determined whether the Redis cache stores user permission information and whether the Web cache stores sub-permission information of the reference directory. If the Redis cache stores user permission information and the Web cache stores sub-permission information of the reference directory, it is determined whether the update identifier in the Redis cache is consistent with the update identifier in the Web cache. If the update identifiers are inconsistent, it indicates that the Web cache does not store the latest permission information. Therefore, the permission information in the Web cache cannot be used to display the target information corresponding to the reference directory. The target information corresponding to the target directory is determined and displayed directly from the permission information in the Redis cache. The permission information in the Web cache is cleared, and the directory identifier or corresponding control identifier of the next-level reference directory corresponding to the target directory in the Redis cache is stored. The update identifier in the Redis cache is then stored in the Web cache.
[0101] By adding update flags to Redis cache and web cache, and checking whether the update flags of Redis cache and web cache are consistent before using web cache, the system avoids using the previous permission information when using permission information in web cache, which could lead to important system pages displaying directories and controls that the user does not have permission to, thus causing data leakage or privacy security issues, thereby improving the security of the default business system.
[0102] In this embodiment of the application, when the Redis cache stores the user's permission information, the Web cache stores the sub-permission information of the target directory, and the update identifier in the Redis cache and the update identifier in the Web cache are consistent, it indicates that the permission information of the target directory stored in the Web cache is the latest permission information. The sub-permission information of the target directory in the Web cache is directly used to determine and display the target information corresponding to the target directory.
[0103] When the updated identifier is consistent, the information in the web cache can be used directly without having to query the corresponding permission information from the Redis cache again. This improves the display speed of the target information while ensuring the security of the business system.
[0104] In one example, user A's permission information includes: directory identifiers 10 and 20 for the first-level reference directories A and B, directory identifiers 1001 and 1002 for the second-level reference directories A1 and A2 corresponding to reference directory A, and control identifiers 100101 and 100102 for operation control 1 and operation control 2 corresponding to reference directory A1.
[0105] The administrator modifies user A's permission information via the terminal and stores the updated permission information in the database. The updated permission information adds a permission identifier of 1003 for the second-level reference directory A3 corresponding to reference directory A. Upon detecting a change in user A's permission information in the database, the administrator deletes user A's permission information from the Redis cache. When user A logs into the preset business system again, the updated permission information in the database is stored in the Redis cache, and the update identifier in the Redis cache is updated from 1 to 2.
[0106] User A triggers reference directory A. In response to User A's trigger operation on reference directory A, it is determined that the Redis cache stores the user's permission information and update identifier 2, and the Web cache stores the sub-permission information and update identifier 1 of reference directory A. Since the update identifier in the Redis cache is inconsistent with the update identifier in the Web cache, the directory identifiers 1001, 1002, and 1003 of reference directories A1, A2, and A3 corresponding to reference directory A are retrieved from the Redis cache. Based on the directory identifiers 1001, 1002, and 1003, the corresponding reference directories A1, A2, and A3 are displayed in the preset business system. The permission information in the Web cache is cleared, and the directory identifiers 1001, 1002, and 1003 of reference directories A1, A2, and A3 corresponding to reference directory A and the update identifier 2 in the Redis cache are stored in the Web cache.
[0107] When user A triggers reference directory A again, in response to user A's trigger operation on reference directory A, it is determined that the Redis cache stores user A's permission information and the Web cache stores the sub-permission information of reference directory A. Furthermore, the update flags in both the Redis cache and the Web cache are 2, indicating that the Web cache stores the latest permission information. Therefore, the directory identifiers 1001, 1002, and 1003 of the reference directories A1, A2, and A3 corresponding to A are directly retrieved from the Web cache. Based on the directory identifiers 1001, 1002, and 1003, the corresponding reference directories A1, A2, and A3 are displayed in the preset business system.
[0108] In this embodiment of the application, when a user is using a preset business system, the user is logged out of the preset business system in response to the modification of the user's permission information.
[0109] In one example, when user A is using a preset business system, the administrator updates user A's permission information through the terminal. In response to the administrator's modification of user A's permission information, user A is logged out of the preset business system. After the administrator logs back into the preset business system, they will browse and operate the preset business system according to the updated permission information.
[0110] After updating user permission information, users currently logged into the system are promptly logged out, preventing them from accessing directories and controls they do not have permission to access, thus improving the security of the pre-set business system.
[0111] The permission management method provided in this application displays reference directories with operation permissions at the current level based on the user's permission information. This eliminates the need for permission checks for each directory or control, and only displays the reference directories and operation controls with permission information within the preset business system. This avoids consistent display across all system pages, where users need to perform trigger operations to determine if they have the necessary permissions. This saves users time in the preset business system, improving user experience. Furthermore, eliminating the need for permission checks for each directory and control significantly reduces system processing pressure. Updating permission information using directory and control identifiers simplifies permission management, saving workload and cost. With permission information remaining unchanged in the database, only one database query is required, reducing database query pressure. Caching permission information in a Redis cache further speeds up system processing. When retrieving permission information from the Redis cache, only the directory identifier of the next-level reference directory or the directory identifier of the corresponding operation control is retrieved, reducing query pressure and time spent retrieving permission information, allowing for rapid display of the retrieved content to the user. By adding update flags to Redis and web caches and checking their consistency before using the web cache, the system avoids using outdated permission information from the web cache, which could lead to important system pages displaying directories and controls that the user does not have permission to access, potentially causing data leaks or privacy issues. This improves the security of the default business system. Furthermore, when the update flags are consistent, the system directly uses information from the web cache without needing to query the Redis cache again, thus improving the display speed of target information while ensuring business system security.
[0112] This application provides an access control device, such as... Figure 5 As shown, the permission management device 30 may include a display module 501 and a response module 502.
[0113] The display module 501 is used to display the reference directory of the current level of the preset business system. The reference directory of the current level matches the user's permission information. The permission information is used to indicate the directory identifier of at least two levels of reference directories. There is at least one reference directory at each level. The reference directory is the directory that the user has operation permissions in the preset business system. Each reference directory is used to display the corresponding target information when it is triggered.
[0114] The response module 502 is used to respond to a trigger operation on a target directory in the reference directory of the current level, and to determine and display the target information corresponding to the target directory from the permission information pre-stored in the first storage area.
[0115] The target information corresponding to the lowest-level reference directory includes at least one corresponding operation control, and the target information corresponding to the reference directories of other levels includes at least one reference directory of the next level.
[0116] The apparatus in this application embodiment can execute the method provided in this application embodiment, and the implementation principle is similar. The actions performed by each module in the apparatus of each embodiment of this application correspond to the steps in the method of each embodiment of this application. For detailed functional descriptions of each module of the apparatus, please refer to the descriptions in the corresponding methods shown above, which will not be repeated here.
[0117] Furthermore, in one possible implementation, the response module of the access control device includes:
[0118] The first response unit is used to respond to a triggered operation on the target directory in the reference directory of the current level, if it is determined that the Redis cache does not store permission information;
[0119] The first display unit is used to determine and display the target information corresponding to the target directory from the permission information stored in the first storage area, and to store the sub-permission information of the target directory in the Web cache.
[0120] The first storage area is either a Redis cache or a database. When the first storage area is a Redis cache, before displaying the target information corresponding to the target directory, the process also includes: storing the permission information pre-stored in the database into the Redis cache.
[0121] When the first storage area is a database, it also includes: storing the permission information pre-stored in the database into the Redis cache;
[0122] Specifically, when the target directory is the lowest-level reference directory, the sub-permission information of the target directory is used to indicate the control identifier of at least one corresponding operation control; when the target directory is not the lowest-level reference directory, the sub-permission information of the target directory is used to indicate the directory identifier of at least one next-level reference directory.
[0123] In the target information, when the target directory is the lowest level reference directory, the sub-permission information of the target directory is used to indicate the control identifier of at least one corresponding operation control. When the target directory is not the lowest level reference directory, the sub-permission information of the target directory is used to indicate the directory identifier of at least one next-level reference directory.
[0124] In another possible implementation, the response module of the access control device includes:
[0125] The second cache unit is used to respond to the trigger operation of the target directory in the reference directory of the current level. If it is determined that the Web cache does not store the sub-permission information of the target directory and the Redis cache has stored the permission information, then the Redis cache is used as the first storage area.
[0126] The second display unit is used to determine and display the target information corresponding to the target directory from the permission information stored in the first storage area, and to store the sub-permission information of the target directory in the Web cache.
[0127] Specifically, when the target directory is the lowest-level reference directory, the sub-permission information of the target directory is used to indicate the control identifier of at least one corresponding operation control; when the target directory is not the lowest-level reference directory, the sub-permission information of the target directory is used to indicate the directory identifier of at least one next-level reference directory.
[0128] In yet another possible implementation, the access control device also includes:
[0129] The delete module is used to delete the permission information stored in the Redis cache when the permission information stored in the database is updated;
[0130] The update module updates the update flag for permission information. The update flag indicates the number of times permission information in the Redis cache has been updated.
[0131] The caching module is used to store the sub-permission information of the target directory and the update identifier of the permission information to the web cache;
[0132] The first judgment module is used to determine if the update identifier of the permission information stored in the Web cache is inconsistent with the update identifier of the permission information stored in the Redis cache, and then the Redis cache is used as the first storage area; from the permission information stored in the first storage area, the target information corresponding to the target directory is determined and displayed, and the sub-permission information of the target directory stored in the Web cache is replaced with the sub-permission information of the target directory in the Redis cache.
[0133] If the update identifier of the permission information stored in the Web cache is determined to be consistent with the update identifier of the permission information stored in the Redis cache, then the Web cache will be used as the first storage area.
[0134] Determine and display the target information corresponding to the target directory from the permission information stored in the first storage area.
[0135] In another possible implementation, in response to a user's first login operation to the preset business system, the user's permission information is retrieved from the database and stored in the Redis cache; the top-level reference directory is displayed based on the permission information stored in the Redis cache, and the permission information of the top-level reference directory is stored in the web cache.
[0136] In response to the user's first trigger operation on the target directory in the reference directory, the sub-permission information of the target directory is retrieved from the Redis cache. Based on the sub-permission information of the target directory, the target information corresponding to the target directory is displayed, and the sub-permission information of the target directory is stored in the Web cache.
[0137] Specifically, when the target directory is the lowest-level reference directory, the sub-permission information of the target directory is used to indicate the control identifier of at least one corresponding operation control; when the target directory is not the lowest-level reference directory, the sub-permission information of the target directory is used to indicate the directory identifier of at least one next-level reference directory.
[0138] In yet another possible implementation, the directory identifier of the next-level reference directory corresponding to the target directory includes the directory identifier of the target directory;
[0139] The control identifier for the operation control corresponding to the target directory includes the identifier of the target directory.
[0140] In yet another possible implementation, the access control device also includes:
[0141] The logout module is used to log users out of the default business system when the user is using the system, in response to changes in the user's permission information.
[0142] This application provides an electronic device (computer apparatus / device / system) including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps of the method, which can achieve the following compared to related technologies:
[0143] The permission management method provided in this application displays reference directories with operation permissions at the current level using the user's permission information. This eliminates the need for permission checks on each directory or control, and only displays reference directories and operation controls with permission information within the preset business system. This avoids inconsistent display across all system pages, where users need to perform a trigger operation to determine if they have the necessary permissions. This saves users time in the preset business system, improving user experience. Furthermore, eliminating the need for permission checks on each directory and control significantly reduces system processing load. When a user triggers a target directory, only the permission information corresponding to the target directory is retrieved from the first storage area, avoiding the retrieval of useless permission information, improving the speed of permission information retrieval, and increasing the speed of displaying target information in the business system, thus reducing user waiting time.
[0144] In one alternative embodiment, an electronic device is provided, such as Figure 6 As shown, Figure 6 The illustrated electronic device 4000 includes a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of this application.
[0145] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0146] Bus 4002 may include a pathway for transmitting information between the aforementioned components. Bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 4002 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0147] The memory 4003 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium capable of carrying or storing computer programs and capable of being read by a computer, without limitation herein.
[0148] The memory 4003 stores computer programs that execute embodiments of this application, and its execution is controlled by the processor 4001. The processor 4001 executes the computer programs stored in the memory 4003 to implement the steps shown in the foregoing method embodiments.
[0149] The electronic device package may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (such as in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.
[0150] This application provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program can implement the steps and corresponding content of the aforementioned method embodiments. Compared with the prior art, it can achieve the following:
[0151] The permission management method provided in this application displays reference directories with operation permissions at the current level using the user's permission information. This eliminates the need for permission checks on each directory or control, and only displays reference directories and operation controls with permission information within the preset business system. This avoids inconsistent display across all system pages, where users need to perform a trigger operation to determine if they have the necessary permissions. This saves users time in the preset business system, improving user experience. Furthermore, eliminating the need for permission checks on each directory and control significantly reduces system processing load. When a user triggers a target directory, only the permission information corresponding to the target directory is retrieved from the first storage area, avoiding the retrieval of useless permission information, improving the speed of permission information retrieval, and increasing the speed of displaying target information in the business system, thus reducing user waiting time.
[0152] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium, a computer-readable medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0153] This application also provides a computer program product, including a computer program that, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments. Compared with the prior art, it can achieve:
[0154] The permission management method provided in this application displays reference directories with operation permissions at the current level using the user's permission information. This eliminates the need for permission checks on each directory or control, and only displays reference directories and operation controls with permission information within the preset business system. This avoids inconsistent display across all system pages, where users need to perform a trigger operation to determine if they have the necessary permissions. This saves users time in the preset business system, improving user experience. Furthermore, eliminating the need for permission checks on each directory and control significantly reduces system processing load. When a user triggers a target directory, only the permission information corresponding to the target directory is retrieved from the first storage area, avoiding the retrieval of useless permission information, improving the speed of permission information retrieval, and increasing the speed of displaying target information in the business system, thus reducing user waiting time.
[0155] The terms "first," "second," "third," "fourth," "1," "2," etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that shown in the figures or text.
[0156] It should be understood that although arrows indicate various operation steps in the flowcharts of this application's embodiments, the order in which these steps are implemented is not limited to the order indicated by the arrows. Unless explicitly stated herein, in some implementation scenarios of this application's embodiments, the implementation steps in each flowchart can be executed in other orders as required. Furthermore, some or all steps in each flowchart, based on the actual implementation scenario, may include multiple sub-steps or multiple stages. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage can also be executed at different times. In scenarios where execution times differ, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and this application's embodiments do not limit this.
[0157] The above description is only an optional implementation method for some implementation scenarios of this application. It should be noted that for those skilled in the art, other similar implementation methods based on the technical concept of this application without departing from the technical concept of this application also fall within the protection scope of the embodiments of this application.
Claims
1. A method for managing access permissions, characterized in that, include: Display the reference directory of the current level of the preset business system, and the reference directory of the current level is matched with the user's permission information; The permission information is used to indicate the directory identifiers of at least two levels of reference directories. The number of reference directories at each level is at least one. The reference directories are directories that the user has operation permissions in the preset business system. Each reference directory is used to display the corresponding target information when it is triggered. In response to a trigger operation on a target directory in the reference directory of the current level, the target information corresponding to the target directory is determined and displayed from the permission information pre-stored in the first storage area; The target information corresponding to the lowest level reference directory includes at least one corresponding operation control, and the target information corresponding to the reference directories of other levels besides the lowest level includes at least one reference directory of the next level. The step of responding to a trigger operation on a target directory in the reference directory of the current level, determining and displaying target information corresponding to the target directory from the permission information pre-stored in the first storage area, includes: In response to a triggered operation targeting a target directory in the reference directory of the current level, if it is determined that the Redis cache does not store the permission information; From the permission information stored in the first storage area, determine and display the target information corresponding to the target directory, and store the sub-permission information of the target directory in the Web cache; The first storage area is the Redis cache or the database, and when the first storage area is the Redis cache, before displaying the target information corresponding to the target directory, the method further includes: storing the permission information pre-stored in the database into the Redis cache; When the first storage area is the database, the method further includes: storing the permission information pre-stored in the database into the Redis cache; The method further includes: deleting the permission information stored in the Redis cache when the permission information stored in the database is updated; The step of storing the permission information pre-stored in the database to the Redis cache further includes: updating the update identifier of the permission information, wherein the update identifier is used to represent the number of times the permission information in the Redis cache has been updated; The step of storing the sub-permission information of the target directory to the Web cache includes: storing the sub-permission information of the target directory and the update identifier of the permission information to the Web cache; The response to the triggering operation for a target directory in the reference directory of the current level further includes: If it is determined that the update identifier of the permission information stored in the Web cache is inconsistent with the update identifier of the permission information stored in the Redis cache, then the Redis cache is used as the first storage area; From the permission information stored in the first storage area, determine and display the target information corresponding to the target directory, and replace the sub-permission information of the target directory stored in the Web cache with the sub-permission information of the target directory in the Redis cache; If it is determined that the update identifier of the permission information stored in the Web cache is consistent with the update identifier of the permission information stored in the Redis cache, then the Web cache is used as the first storage area; The target information corresponding to the target directory is determined and displayed from the permission information stored in the first storage area.
2. The access control method according to claim 1, characterized in that, When the target directory is the lowest level reference directory, the sub-permission information of the target directory is used to indicate the control identifier of at least one corresponding operation control. When the target directory is not the lowest level reference directory, the sub-permission information of the target directory is used to indicate the directory identifier of at least one next-level reference directory.
3. The access control method according to claim 1, characterized in that, The step of responding to a trigger operation on a target directory in the reference directory of the current level, determining and displaying target information corresponding to the target directory from the permission information pre-stored in the first storage area, includes: In response to a trigger operation on a target directory in the reference directory of the current level, if it is determined that the Web cache does not store the sub-permission information of the target directory and the Redis cache has stored the permission information, then the Redis cache is used as the first storage area. From the permission information stored in the first storage area, determine and display the target information corresponding to the target directory, and store the sub-permission information of the target directory in the Web cache; Wherein, when the target directory is the lowest level reference directory, the sub-permission information of the target directory is used to indicate the control identifier of at least one corresponding operation control; when the target directory is not the lowest level reference directory, the sub-permission information of the target directory is used to indicate the directory identifier of at least one next-level reference directory.
4. The access control method according to claim 1, characterized in that, The method further includes: In response to the user's first login operation to the preset business system, the system retrieves the user's permission information from the database and stores the permission information in the Redis cache; it then displays the top-level reference directory based on the permission information stored in the Redis cache and stores the permission information of the top-level reference directory in the web cache. In response to the user's first trigger operation targeting the target directory in the reference directory, the sub-permission information of the target directory is obtained from the Redis cache, the target information corresponding to the target directory is displayed based on the sub-permission information of the target directory, and the sub-permission information of the target directory is stored in the Web cache; Wherein, when the target directory is the lowest level reference directory, the sub-permission information of the target directory is used to indicate the control identifier of at least one corresponding operation control; when the target directory is not the lowest level reference directory, the sub-permission information of the target directory is used to indicate the directory identifier of at least one next-level reference directory.
5. The access control method according to any one of claims 1-4, characterized in that, The directory identifier of the next-level reference directory corresponding to the target directory includes the directory identifier of the target directory; The control identifier of the operation control corresponding to the target directory includes the identifier of the target directory.
6. The access control method according to any one of claims 1-4, characterized in that, Also includes: If the user is using the preset business system, the user will be logged out of the preset business system in response to the modification of the user's permission information.
7. A permission management device, characterized in that, include: The display module is used to display the reference directory of the current level of the preset business system. The reference directory of the current level is matched with the user's permission information. The permission information is used to indicate the directory identifier of at least two levels of reference directories. The number of reference directories at each level is at least one. The reference directory is the directory in the preset business system that the user has operation permissions for. Each reference directory is used to display the corresponding target information when it is triggered. The response module is used to respond to a trigger operation on a target directory in the reference directory of the current level, and to determine and display the target information corresponding to the target directory from the permission information pre-stored in the first storage area. The target information corresponding to the lowest level reference directory includes at least one corresponding operation control, and the target information corresponding to the reference directories of other levels besides the lowest level includes at least one reference directory of the next level. The step of responding to a trigger operation on a target directory in the reference directory of the current level, determining and displaying target information corresponding to the target directory from the permission information pre-stored in the first storage area, includes: In response to a triggered operation targeting a target directory in the reference directory of the current level, if it is determined that the Redis cache does not store the permission information; From the permission information stored in the first storage area, determine and display the target information corresponding to the target directory, and store the sub-permission information of the target directory in the Web cache; The first storage area is the Redis cache or the database, and when the first storage area is the Redis cache, before displaying the target information corresponding to the target directory, the method further includes: storing the permission information pre-stored in the database into the Redis cache; When the first storage area is the database, the method further includes: storing the permission information pre-stored in the database into the Redis cache; The method further includes: deleting the permission information stored in the Redis cache when the permission information stored in the database is updated; The step of storing the permission information pre-stored in the database to the Redis cache further includes: updating the update identifier of the permission information, wherein the update identifier is used to represent the number of times the permission information in the Redis cache has been updated; The step of storing the sub-permission information of the target directory to the Web cache includes: storing the sub-permission information of the target directory and the update identifier of the permission information to the Web cache; The response to the triggering operation for a target directory in the reference directory of the current level further includes: If it is determined that the update identifier of the permission information stored in the Web cache is inconsistent with the update identifier of the permission information stored in the Redis cache, then the Redis cache is used as the first storage area; From the permission information stored in the first storage area, determine and display the target information corresponding to the target directory, and replace the sub-permission information of the target directory stored in the Web cache with the sub-permission information of the target directory in the Redis cache; If it is determined that the update identifier of the permission information stored in the Web cache is consistent with the update identifier of the permission information stored in the Redis cache, then the Web cache is used as the first storage area; The target information corresponding to the target directory is determined and displayed from the permission information stored in the first storage area.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-6.
Citation Information
Patent Citations
Directory display method and device, computer equipment and computer readable storage medium
CN112035478A
Authority management method and related device
CN114528274A