Method and system for controlling authority, electronic device and storage medium
By defining identifier field values in custom directives and front-end routing configuration files, and combining them with a visual interface for permission directives and identifier codes, the system achieves both precision and flexibility in permission control, solving the problems of imprecise permission control and cumbersome adjustments in existing technologies.
Patent Information
- Application Number
- CN202210234315.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-10
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2042-03-10
AI Technical Summary
Existing technologies suffer from imprecise scope of access control, a large workload and a high risk of errors during access adjustment, especially when front-end code changes, which can lead to control errors due to the inability to update access information in a timely manner.
By declaring permission instructions in a custom instruction initialization file, and defining identifier field values in conjunction with the meta attribute in the front-end route configuration file, the user permission information is determined in the visual permission configuration interface using permission instructions and identifier codes, and then saved to the database, thus achieving precise permission control over the target control.
It enables precise control over the scope of permissions, reduces the manual cost of system maintenance, simplifies the permission adjustment process, ensures consistency between permission information on the front-end page and in the database, and avoids permission control errors.
Smart Images

Figure CN114741705B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of permission management, and in particular to a permission control method and system, an electronic device and a storage medium. BACKGROUND
[0002] In the face of large-volume users and multi-functional business scenarios, different users have different functional needs, and different pages and different functional controls need to be controlled according to the needs of the users.
[0003] In the prior art related to the present application, a CSS selector is usually used to determine the target control of the target page that needs to be controlled, and then a pre-maintained permission control table is used to implement permission control of the target control. However, the above technical solution has the following problems:
[0004] 1. Since multi-functional target pages are usually developed by different developers, and the development specifications of different developers are different, there is no uniform standard for CSS coding. However, in the above technical solution, the CSS in the front-end code of the target page is selected by the CSS selector to determine the range of the target control to be controlled. Therefore, when the target control of the target page that needs to be controlled is determined by the CSS selector, the different CSS writing methods will cause the actual target control range corresponding to the CSS in the target page to be greater or less than the target control range that needs to be controlled, so that precise control of the functional control cannot be achieved when the CSS coding specifications are not uniform; and the user's demand for accurate control of the permission range cannot be met. Therefore, in the above technical solution, the permission control range is not accurate.
[0005] 2. As user needs change, different developers will continuously update the target page according to user needs. Since the continuous updating of the target page is performed in the front-end code, the CSS in the front-end code will change, causing the target control determined by the CSS selector to change in the updated target page, resulting in errors in the permission control range. In order to avoid errors in the permission control range, the CSS in the front-end code of the target page and the CSS object in the CSS selector must be kept consistent, and the CSS object of the CSS selector must be updated in real time according to the front-end code of the target page, which requires long-term maintenance.
[0006] 3. The prior art uses a front-end and back-end separation development mode. Since the CSS object value in the user permission table must be consistent with the front-end to enable permission control of the target control, if the permission information in the database is not updated in time when the front-end changes, permission control errors will occur. SUMMARY
[0007] The application aims to solve the above problems, and provides a permission control method, system, electronic device and storage medium, which solve the problems of inaccurate permission control range, large workload in permission adjustment process and permission control error.
[0008] To solve the above problems, the embodiments of the application provide a permission control method, which comprises the following steps: declaring a permission instruction in a custom instruction initialization file, the permission instruction being used to call a permission method to control control permission; parameters of the permission method comprising an operation object and a binding identifier; defining an identifier field value in a meta attribute in a front-end routing configuration file of a target page; calling the permission instruction in each target control, determining, according to the permission instruction, that the identifier field value is an incoming parameter of the binding identifier, and that the target control is an incoming parameter of the operation object; rendering a visual permission configuration interface according to the meta attribute, determining user permission information in the visual permission configuration interface, and saving the user permission information to a database, the permission information comprising first-level permission information and second-level permission information, the first-level permission information being an identifier field value corresponding to a permission instruction required by the user in the target page, and the second-level permission information being permission of a sub-control in the target control corresponding to the permission instruction required by the user in the target page, the second-level permission information being determined by configuration identifier code, the identifier code being determined according to front-end code of the target page; and rendering and displaying the target page according to the permission information, wherein when rendering to the permission instruction, the operation object and the binding identifier are determined according to the permission instruction, and the permission method is called to control the target control.
[0009] To solve the above problems, the embodiments of the application provide a permission control system, which comprises: a declaration module, configured to declare a permission instruction in a custom instruction initialization file, the permission instruction being used to call a permission method to control control permission; parameters of the permission method comprising an operation object and a binding identifier; a definition module, configured to define an identifier field value in a meta attribute in a front-end routing configuration file of a target page; call the permission instruction in each target control, and determine, according to the permission instruction, that the identifier field value is an incoming parameter of the binding identifier, and that the target control is an incoming parameter of the operation object; a configuration module, configured to render a visual permission configuration interface according to the meta attribute, determine user permission information in the visual permission configuration interface, and save the user permission information to a database, the permission information comprising first-level permission information and second-level permission information, the first-level permission information being an identifier field value corresponding to a permission instruction required by the user in the target page, and the second-level permission information being permission of a sub-control in the target control corresponding to the permission instruction required by the user in the target page, the second-level permission information being determined by configuration identifier code, the identifier code being determined according to front-end code of the target page; and a rendering module, configured to render and display the target page according to the permission information, wherein when rendering to the permission instruction, the operation object and the binding identifier are determined according to the permission instruction, and the permission method is called to control the target control.
[0010] To solve the above problems, the embodiments of the present application also provide an electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the above-mentioned permission control method.
[0011] To solve the above problems, the embodiments of the present application also provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the above-mentioned permission control method.
[0012] The permission control method, system, electronic device and storage medium provided by the embodiments of the present application can call permission instructions in each target control, associate a larger target control with the permission instructions for permission control, realize larger permission range control, and further configure an identification code for each target control to realize permission control of the sub-controls of the target control. That is, the permission instructions first limit the control range of the permission, and then the target control is configured with an identification code to achieve the effect of further dividing the control range of the permission in the determined control range, so that the permission range controlled by the permission method provided by the embodiments of the present application is more accurate, and accurate control of the control is realized. In the present application, the visual permission configuration interface is obtained by rendering according to the identification field value defined in the meta attribute in the front-end routing configuration file of the target page, and the permission information is obtained according to the visual permission configuration interface, so that the permission information and the front-end page always remain consistent, and correct control of the control is realized. In the present application, the user can directly configure and adjust the user permission information on the visual interface, without the need for manual real-time update and maintenance of the permission information, so that the permission adjustment is more flexible, the permission range adjustment process is simpler, and the labor cost of system maintenance is greatly reduced.
[0013] In addition, the visual permission configuration interface includes an enable configuration interface and an authorization configuration interface, wherein the enable configuration interface is obtained by rendering according to the meta attribute; and the authorization configuration interface is obtained by rendering according to the enabled permission instructions in the enable configuration interface. The data stored in the final database is consistent with the data in the front-end code, and the error of permission control is avoided.
[0014] Further, the permission information of the user is determined in the visual permission configuration interface, including: in the enable configuration interface, the permission instruction required to be enabled by the target page is determined from the permission instruction corresponding to the identification field value; in the authorization configuration interface, the permission instruction required by the user in the target page is determined from the enabled permission instruction, and first-level permission information is obtained; in the enable configuration interface, the identification code of the sub-control required to be controlled is configured for the target control corresponding to the permission instruction, and the enabled identification code is determined from the configured identification code, and second-level permission information is obtained. By controlling the corresponding target control in the visual permission configuration page, for the permission instruction defined in advance, it can be controlled and adjusted according to the visual permission configuration interface, without modifying the front-end code, significantly reducing the workload of the developer, and reducing the requirements for the personnel operating the scheme, even if the ordinary business personnel can also adaptively adjust the permission information according to the user demand.
[0015] Further, the permission method includes: obtaining the permission information of the user; obtaining an unauthorized information list according to the permission instruction in the visual permission configuration interface and the permission information of the user; judging whether the currently rendered permission instruction is in the unauthorized information list; in the case that the permission instruction is in the unauthorized information list, obtaining the identification code configured for the target control corresponding to the permission instruction; judging whether the identification code configured for the target control corresponding to the permission instruction is in the unauthorized information list; in the case that the identification code configured for the target control corresponding to the permission instruction is in the unauthorized information list, performing permission operation on the sub-control corresponding to the identification code; in the case that the identification code configured for the target control corresponding to the permission instruction is not in the unauthorized information list, performing permission operation on the target control corresponding to the permission instruction. When the permission instruction of the target page is rendered, the front-end performs permission operation on the target control which the user does not have operation permission according to the permission information of the user, so that the user cannot use the control in the unauthorized information list.
[0016] Further, the permission information of the user includes a mode field, and the value of the mode field is obtained through the visual configuration interface; in the case that the value of the mode field is removal, the permission operation is removal; in the case that the value of the mode field is disabled, the permission operation is disabled. The value of the mode field is determined in the visual configuration interface to decide which operation is used to limit the permission of the target control when the permission of the target control or the control needs to be limited, different operations are performed according to the different values of the mode field, and the business demand of different users is met.
[0017] In addition, the target control is a commonly used target control, and the sub-control in the target control is a special sub-control, wherein the commonly used target control is a target control with a usage frequency greater than a first preset threshold; and the special sub-control is a sub-control with a usage frequency less than a second preset threshold. The permission instruction is called in the target control that needs to be adjusted frequently, and the permission adjustment of the commonly used target control is more simple and convenient. Since the usage frequency of the special sub-control is low, the use of the marking code to control the special sub-control is more in line with the user's permission control requirements.
[0018] In addition, the permission of the URL is controlled by using the identification field value and / or the identification code. By using the field value or the identification code to control the use of the URL, the backend cannot use the URL through the code, thereby realizing real permission control of the URL.
[0019] In addition, before the target page is rendered and displayed according to the permission information, the method further includes: generating a corresponding query SQL according to a page route of the target page when the user accesses the target page; querying the permission information of the user in the database according to the query SQL; and realizing that the front end obtains the corresponding permission information according to the target page accessed by the user, thereby providing a basis for subsequent rendering of the permission instruction. BRIEF DESCRIPTION OF DRAWINGS
[0020] One or more embodiments are illustrated by way of example in the figures that form a part of this patent document. These example are not intended to limit the application, but to clarify exemplary examples for illustrative purposes of the claimed application. Elements having the same reference numbers in figures across one or more embodiments indicate same or similar elements. The figures in the drawings are not necessarily to scale, with emphasis being placed upon illustrating the principles of the application.
[0021] Figure 1 is a flowchart of a permission control method provided by an embodiment of the application;
[0022] Figure 2 is a flowchart of a rendering process provided by an embodiment of the application;
[0023] Figure 3 is a structural schematic diagram of a permission control system provided by an embodiment of the application;
[0024] Figure 4 is a structural schematic diagram of an electronic device provided by an embodiment of the application. DETAILED DESCRIPTION
[0025] As known from the background, there is an urgent need to provide a new permission control method to solve the problems of inaccurate permission control range, large workload in permission adjustment process, and permission control errors in the prior art.
[0026] To solve the above problems, the embodiment of the present application provides a permission control method, comprising the following steps: declaring a permission instruction in a self-defined instruction initialization file, which is used to call a permission method to control the permission of a control; the parameters of the permission method include an operation object and a binding identifier; defining an identifier field value in a meta attribute in a front-end routing configuration file of a target page; calling the permission instruction in each target control, determining that the identifier field value is an incoming parameter of the binding identifier according to the permission instruction, and the target control is an incoming parameter of the operation object; rendering a visual permission configuration interface according to the meta attribute, determining the permission information of a user in the visual permission configuration interface, and saving the permission information of the user to a database; the permission information includes first-level permission information and second-level permission information; the first-level permission information is an identifier field value corresponding to a permission instruction required by the user in the target page; the second-level permission information is the permission of a sub-control in a target control corresponding to the permission instruction required by the user in the target page; the second-level permission information is determined by a configuration identifier code; the configuration identifier code is determined according to the front-end code of the target page; and rendering and displaying the target page according to the permission information, wherein when the permission instruction is rendered, the operation object and the binding identifier are determined according to the permission instruction, and the permission method is called to control the permission of the target control.
[0027] The permission control method provided by the embodiment of the present application controls the permission of a larger target control by calling the permission instruction in each target control, controls the permission of the sub-control of the target control by configuring an identifier code for each target control, and thus the control range of the permission is limited in the first step, and the control range of the permission is further divided in the determined control range by configuring the identifier code for the target control, so that the control range of the permission controlled by the permission method provided by the embodiment of the present application is more accurate, and the control of the control is accurate. In the present application, the visual permission configuration interface is rendered according to the identifier field value defined in the meta attribute in the front-end routing configuration file of the target page, and the permission information is obtained according to the visual permission configuration interface, so that the permission information and the front-end page always remain consistent, and the control of the control is correct. In the present application, the user can directly configure and adjust the permission information of the user in the visual interface, and the permission information does not need to be updated and maintained in real time by manual operation, so that the permission adjustment is more flexible, the permission range adjustment process is simpler, and the labor cost of system maintenance is greatly reduced.
[0028] To make the purposes, technical solutions, and advantages of the embodiments of the present application clearer, the various embodiments of the present application will be described in detail below with reference to the drawings. However, those of ordinary skill in the art can understand that, in the various embodiments of the present application, many technical details are presented in order to make the present application better understood by the readers. However, the technical solutions claimed by the present application can be implemented even without these technical details and based on various changes and modifications of the following various embodiments.
[0029] The embodiments of the present application relate to a permission control method, and the implementation details of the method in the embodiments will be specifically described below. The following content is only for the convenience of understanding the implementation details of the present solution, and is not necessary for implementing the present solution. The specific flow can include the following steps as shown in Figure 1
[0030] In step 101, a permission instruction is declared in a self-defined initialization file, which is used to call a permission method to control the control permission; the parameters of the permission method include an operation object and a binding identifier.
[0031] In the embodiments, the declaration of the permission instruction in the self-defined initialization file is implemented based on a Vue framework, wherein the Vue is a progressive framework for building user interfaces, and the permission method in the embodiments is established by using a registered self-defined directive() method provided by the Vue, which is used to specify the triggering time of the permission method, that is, under what conditions the business logic of the permission method is executed.
[0032] In one example, the permission method uses a hook function inserted, which indicates that the hook function is called when the bound element is inserted into the parent node, wherein the hook function inserted contains two parameters: an el operation object and a binding identifier, and the program logic of the hook function is: obtaining an unauthorized information list corresponding to the page from a resource library, if the unauthorized information list data is obtained from the database, a business function is called.
[0033] In another example, the program logic of the hook function can also be: obtaining an authorized information list corresponding to the page from the resource library, wherein the authorized information list stores permission instructions with which the user has operation permissions, and if the authorized information list data is obtained from the database, a business function is called.
[0034] It should be noted that the application does not specifically limit the function used by the permission method, and does not specifically limit the specific program logic of the hook function. In the embodiment of the application, other hook functions such as the componentUpdated hook function can be selected according to specific business needs, and the hook functions can also be used in combination. In addition, since the hook function is a function provided by the framework for specifying the triggering time of the program, the hook function provided by the framework can also be used to customize the triggering time of the program.
[0035] In one example, the called business function is used to perform a permission operation on a control without authorization permission, wherein the function control is controlled by the permission instruction and the identification code. The business logic of the above business function is to obtain the unauthorized information list corresponding to the page from the resource library, if the binding identification value of the currently rendered permission instruction is in the unauthorized information list, that is, the permission instruction is in the unauthorized information list, the permission operation on the currently rendered control is performed, so that the current user cannot use the function; for the permission instruction not in the unauthorized information list, no operation is performed, that is, the current user can use the corresponding function control.
[0036] In another example, the business logic of the business function can also be to obtain the authorized information list corresponding to the page from the resource library, if the binding identification value of the currently rendered permission instruction is not in the authorized information list, that is, the permission instruction is not in the authorized information list, the permission operation on the currently rendered control is performed, so that the current user cannot use the function control; for the permission instruction in the authorized information list, no operation is performed, that is, the current user can use the corresponding function control.
[0037] It should be noted that the embodiment of the application does not specifically limit the business logic of the business function, and only needs to make the function control corresponding to the unauthorized permission instruction or identification code unable to be used by the user, and the specific business logic can be set according to specific needs.
[0038] In step 102, the identification field value is defined in the meta attribute in the front-end routing configuration file of the target page; the permission instruction is called in each target control, and the identification field value is determined as the binding identification of the input parameter according to the permission instruction, and the target control is the input parameter of the operation object.
[0039] In the embodiment of the application, each route has its own meta attribute, and the meta attribute refers to the routing information carried on each route. The identification field value is defined in the meta attribute in the routing configuration file of the target page.
[0040] In one example, the identification field value is defined under the corresponding route page in the routing configuration file, and the code is as follows:
[0041]
[0042]
[0043] In the above code, the identification field value is defined in the target page, as shown in the above code: there are two identification field values in the target page " / common / test", 'bp-has-test-input-test1' and 'bp-has-test-input-test2' are respectively the identification field values corresponding to the permission instruction.
[0044] In addition, in the embodiment of the present application, the permission of the URL can also be controlled by using the identification field value, that is, the URL that needs to be controlled by permission can be added in the above code, and the specific code is as follows:
[0045] {key: 'bp-has-test-input-test2', name: 'test2', url: ' / frontend / api / user / route / test2'}
[0046] In the above code, the URL is added in the code of defining the identification field value to control the use of the URL. In the case that the permission instruction of the URL is unauthorized, the URL is intercepted by the interceptor so that the URL cannot be used by the user.
[0047] It is worth mentioning that since multiple controls are usually displayed in the target page, the controls will not be displayed in the target page in the case of unauthorized controls, but this does not mean that the corresponding URL in the control cannot be used by the user. In the prior art, the above URL can be called by the backend code for the user to use, so the real control of the use of the URL is not realized. However, by using the use permission instruction in the embodiment of the present application to control the use of the above URL, in the case that the URL is not authorized, even through the backend code, the use of the above URL cannot be realized, so the real control of the permission of the URL is realized.
[0048] In the embodiment of the present application, the permission instruction is called in each target control of the target page, that is, the code of the use permission instruction is written in the target control that needs to be controlled by permission, that is, the target control in the target page is associated with the permission instruction.
[0049] In one example, the following code is written in the target control:
[0050]
[0051] In the above code, 'v-has="bp-has-test-input-test1"' indicates that a custom permission instruction is used, and the value of the binding identifier of the permission instruction is specifically written. The value of the binding identifier in the above code is derived from the identifier field value defined under the target page, that is, the identifier field value determined when the permission instruction is called under the target control is used as the value of the binding identifier; the value of the operation object can be determined according to the position of the written code, and the value of the operation object is derived from the target control using the permission instruction. In the above code, the identifier field value 'bp-has-test-input-test1' is the incoming parameter of the binding identifier binding, that is, the binding identifier binding is 'bp-has-test-input-test1', and the target control 'el-form-item' is the incoming parameter of the operation object el, that is, the operation object el is 'el-form-item'.
[0052] In the above example, by calling each permission instruction under each target control, a corresponding relationship between the permission instruction and the target control is established, and permission control of different target controls through the permission instruction is realized.
[0053] In step 103, the visual permission configuration interface is rendered according to the meta attribute, the user's permission information is determined in the visual permission configuration interface, and the user's permission information is saved to the database. The user's permission information includes first-level permission information and second-level permission information. The first-level permission information is the identifier field value corresponding to the permission instruction required by the user in the target page, and the second-level permission information is the permission of the sub-control in the target control corresponding to the permission instruction required by the user in the target page. The second-level permission information is determined by configuration identifier code, and the identifier code is determined according to the front-end code of the target page.
[0054] In the embodiment of the present application, the visual permission configuration interface is rendered according to the meta attribute, and the visual permission configuration interface includes the permission instruction corresponding to the identifier field value defined in the meta attribute in the front-end routing configuration file of the target page. Since the permission instruction is called in each target control of the target page, it can be determined in the visual permission configuration interface whether the user has operation permission for the target control corresponding to the permission instruction by selecting the permission instruction. Moreover, the user's permission information determined in the visual permission configuration interface is also saved to the database.
[0055] It is worth mentioning that the identification field value is defined in the meta attribute in the front-end routing configuration file of the target page, and the visual permission configuration interface is rendered according to the meta attribute, so the list data in the visual permission configuration interface and the data in the target page front-end code remain consistent, that is, the permission instructions corresponding to the identification field value defined in the front-end routing configuration file of the target page are displayed in the visual permission configuration interface, and then when the identification field value in the target page front-end code changes, the visual configuration interface does not need to be manually modified, and the visual permission configuration interface can automatically update the permission configuration interface according to the changed target page front-end code, thereby ensuring the consistency of the permission instructions in the visual permission configuration interface and the permission instructions corresponding to the identification field value defined in the routing page without manual maintenance; in addition, the user's permission information determined in the visual permission configuration interface is automatically saved to the database, and the front-end renders the permission instructions according to the user's permission information, so when the user's permission information configured in the visual permission configuration interface changes, the consistency of the permission information saved in the database and the user's permission information configured in the visual configuration interface is ensured without manually modifying the permission information in the database. Therefore, the permission control method provided in the embodiments of the present application ensures the consistency of the permission information in the database and the permission instructions in the visual permission configuration interface without manual maintenance, simply by adjusting the permissions using the visual permission configuration interface, thereby achieving the purpose of timely updating the permission information in the database, and the consistent front-end and back-end data ensures the accurate operation of the permission control. The problem of permission control error caused by the fact that the permission information in the database is not updated in time in the prior art is solved.
[0056] In the embodiments of the present application, the permission instructions corresponding to the target control with which the user has operation permissions are taken as first-level permission information; and the identification codes of the target control with which the user has operation permissions are taken as second-level permission information, so as to obtain the user's permission information. The identification codes of the target control are consistent with the front-end code of the target page.
[0057] In the embodiments of the present application, the permission instructions under the target control can control the permissions of the target control, however, there can be sub-controls under the target control, and the permission instructions can only control the permissions of the target control, therefore, in order to control the permissions of the sub-controls under the target control, identification codes need to be configured for the target control, the identification codes are determined according to the front-end code of the target page, and are used to identify different controls in the front-end page, so as to control the permissions of the sub-controls under the target control.
[0058] In one example, the editing function control has sub-function controls: editing user and editing page. If a permission instruction is invoked under the editing function control, the editing function control can be controlled in the visual permission configuration interface, that is, the editing user function and the editing page function are controlled as a whole; if the permission instruction is invoked for the editing function control and the identification code for identifying the editing user function control is configured for the editing function control, only the editing user function control is controlled in the visual permission configuration interface, so as to realize adjustment and accurate control of the permission control range. In addition, the identification code configured for the target control can also be used to control the permission of the URL.
[0059] By invoking the permission instruction in each target control, the permission instruction is associated with a larger target control for permission control, realizing control of a larger permission range, and by configuring the identification code for each target control, the permission control of the sub-controls of the target control is realized. Compared with the target control range determined by the CSS in the related art being greater than or less than the required permission control range, the embodiments of the present application first limit the control range of the permission by the permission instruction, and then achieve the effect of further dividing the permission control range in the determined control range by configuring the identification code for the target control, solve the problem of inaccurate permission control range in the prior art, and realize more accurate control of the permission range.
[0060] In one example, the target control can also be a common target control, and the sub-control in the target control can be a special sub-control, wherein the common target control is a target control with a permission change frequency greater than a first preset threshold, and the special sub-control is a sub-control with a permission change frequency less than a second preset threshold. Since the common target control is used by many users and the permission changes frequently, the user often faces the problem of permission granting and cancellation, so it is necessary to ensure that the common target control can be accurately controlled. If there is a slight deviation in the control range, it will cause a huge difference in the final user permission. Since the range controlled by the permission instruction depends on the location of the permission instruction setting, and the permission information in the database always remains consistent with the target page front-end code, accurate control of the common target control can be ensured, and the problem of huge difference in user permission is avoided. If the common target control is controlled by the configuration identification code, the actual control range will be greater than or less than the range of the common target control. The special sub-control is usually a functional control that everyone needs to use or a control that only a small part of people need to use, and the permission changes less frequently, so the number of times of permission adjustment is also less. The configuration identification code can meet the permission control requirements. If the permission instruction is used to control the special sub-control, the identification field value corresponding to the permission instruction needs to be defined in the target page front-end code. If the above permission instruction is not used or rarely used, it will cause additional useless workload. The embodiments of the present application use the permission instruction to control the common target control and use the configuration identification code to control the special sub-component, thereby achieving accurate control of the common target control and avoiding additional and useless workload caused by controlling the special sub-component. The permission control method provided by the embodiments of the present application only needs to be clicked on the visual permission configuration interface to complete the permission adjustment, so that the permission adjustment process of the common target control is more concise, and the workload and labor cost of permission information maintenance are greatly reduced.
[0061] In another example, the permission instruction is called under the entire page, that is, the control range of the permission instruction is the entire page, and the identification code is configured for the entire page to control the permissions of the controls in the entire page, that is, the identification code is used to identify different controls. In the above example, the permission control is completely based on the identification code in the target page, that is, the specific control of which controls and functions is determined by the identification code. For the newly added functional controls in the user permission, the identification code can be configured through the visual permission interface to complete the management of the functional controls. The effect of adaptively adjusting the controls on the visual permission configuration interface at any time according to the needs is achieved, and the permission management is more convenient.
[0062] In yet another example, the permission instruction is invoked under each control, and the identification code configured for each control is empty, that is, only the control and function are controlled through the permission instruction; in the above example, which control and function are controlled by the permission instruction depends on the position of the invoked permission instruction, the control invoking the permission instruction can be set according to actual needs, and the identification field value defined in the routing page and the code of the permission information in the database remain consistent, thereby achieving accurate control of the function control.
[0063] It should be noted that the permission control method provided in the embodiments of the present application can control the control and function through the combination of the permission instruction and the identification code, or can control the control and function through only the permission instruction or only the identification code, and the embodiments of the present application do not limit the specific use scheme, and the specific use scheme can be selected according to actual conditions.
[0064] In the embodiments of the present application, the visualized permission configuration interface includes an enablement configuration interface and an authorization configuration interface, wherein the enablement configuration interface is obtained by rendering according to the meta attribute; and the authorization configuration interface is obtained by rendering according to the enabled permission instruction in the enablement configuration interface. In the enablement configuration interface, the permission instruction that needs to be enabled in the target page is determined from the permission instruction corresponding to the identification field value, the enablement information of the permission instruction is obtained, the identification code of the sub-control that needs to be controlled is configured for the target control corresponding to the permission instruction, and the enabled identification code is determined from the configured identification code, and the secondary permission information is obtained; in the permission configuration interface, the permission instruction that the user needs in the target page is determined from the enabled permission instruction, the primary permission information is obtained, and thus the permission information of the user is obtained. The above-obtained enablement information of the permission instruction and the permission information of the user are saved to the database, that is, the target control and the sub-control that the user has the operation permission.
[0065] In one example, the identification field value defined in the routing page corresponding to the above routing configuration file is displayed in the form of a list in the enablement configuration interface, the data in the list is derived from the step of defining the identification field value in the above routing page, and Table 1 is as follows:
[0066] Table 1
[0067]
[0068] The identification field is displayed according to the identification field value defined in the meta attribute in the above steps, wherein the route page, the permission instruction name, and the identification field value are fixed fields and cannot be modified, the identification code is an input field, and a user inputs an identification code corresponding to a sub-control that needs to be controlled in the identification code field under each permission instruction on a corresponding route page when enabling the configuration interface. Multiple identification codes can be input and separated by commas. The input identification code must exist in the front-end code of the target page and must be consistent with the identification code in the front-end code of the target page. In the embodiment of the present application, the identification code is the CSS of the front-end page, and a value corresponding to the identification code is input through a CSS selector in the enabling configuration interface to configure the identification code for the target control. For example, 3 identification codes ".addUser", ".addLock", and ".removeUser" are input in the identification code selection in the above table; the "identification code enabling" field is a drop-down box, and the identification code input in the "identification code" field is displayed, as shown in the above table. The "identification code enabling" field drop-down box should have 3 options, and the identification code that needs to be enabled is selected, that is, ".addLoc" is selected in the above table. After the above operations of enabling the permission instruction and enabling the identification code are performed, the enabling information of the permission instruction and the enabling information of the identification code are saved in the database. When the enabled permission instruction and the enabled identification code are saved in the database, an ID number corresponding to the enabled permission instruction and the enabled identification code is automatically generated, and the ID of each permission instruction and identification code is unique.
[0069] In the embodiment of the present application, the permission instruction required by the user on the target page is determined from the enabled permission instruction in the authorization configuration interface, and first-level permission information is obtained.
[0070] In one example, the enabling information of the target page permission instruction is obtained from the database, and the obtained enabling information of the permission instruction is displayed on the authorization configuration interface. The authorization configuration interface is used to allocate the permission function to each user, and one or more of the function controls corresponding to the permission instruction are selected. If the selected function controls are operated by the current user, it indicates that the user has the operation permission of the selected function controls. If the selected function controls are not selected, it indicates that the user cannot use the function controls. The permission instruction corresponding to the selected function controls and the information of the identification code enabled by the permission instruction are saved to the database as the permission information of the user, i.e., only the information of the authorized function controls is included. For example, the function controls corresponding to the permission instruction enabled by the target page are "batch setting", "import", and "edit". The edit function control is configured with an identification code, and the identification code for controlling the "edit page" function control permission is enabled. Therefore, the options of "batch setting", "import", and "edit" are displayed on the permission configuration interface. The function controls "batch setting" and "edit" are selected, which indicates that the user has the operation permission of "batch setting" and "edit page" on the target page. Since the edit function control also enables the identification code, the permission information of the user includes the permission instruction information corresponding to "batch setting" and "edit" and the identification code information corresponding to "edit page".
[0071] In another example, when the permission information of the user needs to be adjusted, the permission can also be adjusted on the permission configuration interface. For example, the current permission instructions enabled by the target page correspond to the edit, import, and setting function controls, respectively. The identification codes configured by the import function correspond to the sub-function controls of importing users, deleting users, and importing data, respectively. The identification code enabled by the import function corresponds to the sub-function control of importing users. The adjustment content of the permission information is as follows: the user who has the access permission of the target page adds the lock function to the target page information. The identification field value of the permission instruction corresponding to the lock function is defined in advance. First, it is judged whether the permission instruction corresponding to the lock function is enabled in the enabling configuration interface. If the permission instruction corresponding to the lock function is not enabled, the permission instruction is enabled, and then the operation permission of the lock function is granted to the user on the authorization configuration interface. If the permission instruction corresponding to the lock function is enabled, the operation permission of the lock function is directly granted to the user on the authorization configuration interface. In addition, when the user adds the control permission of the import data function control, the identification code corresponding to the import data function is enabled in the enabling configuration interface, so that the user has the operation permission of the import data function control.
[0072] In the above example, when the user's permission information changes, only the configuration of the interface control permission instruction and / or the identification code of the configuration is enabled, and the operation permission of the function control is granted to the user in the authorization configuration interface, the permission information can be adjusted to the latest permission information, and the above process only involves simple page operation, so that the permission control process is faster.
[0073] It is worth mentioning that the visual permission configuration interface is rendered according to the meta attribute, and since the identification field value is defined in the meta attribute in the front-end routing configuration file of the target page, and each permission instruction is called under each target control of the target page, when the permission instruction is enabled, granted or revoked in the visual permission configuration interface, the user's permission can be adjusted. In addition, since the identification code for controlling the sub-controls of the target control is also configured for each target control, the identification code can also be opened or closed in the visual permission configuration interface to adjust the user's permission, so when the user needs to be assigned the permission of each target control or adjust the user's permission of each target control, the permission can be adjusted by clicking in the visual permission configuration interface, that is, by clicking to determine the function control with operation permission. Compared with the manual maintenance process in the prior art, the permission control method provided in the embodiment of the application can adjust the control according to the visual permission configuration interface regardless of user demand, thereby significantly reducing the workload of the developer and reducing the professional requirements for the personnel operating the scheme. Even ordinary business personnel can also adaptively adjust according to user demand.
[0074] In step 104, the target page is rendered and displayed according to the permission information, wherein when the permission instruction is rendered, the operation object and the binding identification are determined according to the permission instruction, and the permission method is called to control the permission of the target control.
[0075] In the embodiment of the application, the permission method includes: obtaining the permission information of the user; obtaining the unauthorized information list according to the permission instruction in the visual permission configuration interface and the permission information of the user; determining whether the currently rendered permission instruction is in the unauthorized information list; in the case that the permission instruction is in the unauthorized information list, obtaining the identification code configured for the target control corresponding to the permission instruction; determining whether the identification code configured for the target control corresponding to the permission instruction is in the unauthorized information list; in the case that the identification code configured for the target control corresponding to the permission instruction is in the unauthorized information list, performing the permission operation on the sub-control corresponding to the identification code; in the case that the identification code configured for the target control corresponding to the permission instruction is not in the unauthorized information list, performing the permission operation on the target control corresponding to the permission instruction.
[0076] In one example, when a user accesses a target page, the authorization information of the user on the target page and the enabling information of the permission instruction in the target page are obtained from a database, the enabling information of the permission instruction in the target page is subtracted from the authorization information of the user on the target page to obtain an unauthorized information list, a permission method is called according to the value of the binding identifier of the current permission instruction and the value of the operation object, it is judged whether the currently rendered permission instruction is in the unauthorized information list, and in the case that the currently rendered permission instruction is in the unauthorized information list, it is indicated that the user has no operation permission on the target control corresponding to the currently rendered permission instruction. Since the identifier code configured for the target control can be enabled in the visual permission configuration interface, the identifier code configured for the target control needs to be obtained to judge the specific range of the permission control on the target control. After the identifier code configured for the target control is obtained, in the case that the identifier code configured for the currently rendered permission instruction is in the unauthorized information list, the sub-control corresponding to the identifier code is determined in the target control corresponding to the permission instruction, and the permission operation is performed on the sub-control corresponding to the identifier code, otherwise, the permission operation is performed on the target control corresponding to the permission instruction. In the above example, in the case that the identifier code configured for the permission instruction is in the unauthorized information list, it is indicated that the control range of the permission is specific to one or more sub-controls of the target control, therefore, the permission operation only needs to be performed on the sub-control corresponding to the identifier code; in the case that the identifier code configured for the target control is not in the unauthorized information list, it is indicated that the permission control is only performed on the target control, and the permission control is not performed on any sub-control of the target control, therefore, the permission operation only needs to be performed on the target control corresponding to the permission instruction.
[0077] In the embodiments of the present application, in the case that the permission instruction is in the unauthorized information list and the identifier code configured for the target control corresponding to the permission instruction is also in the unauthorized information list, the field value of the identifier code is obtained, the sub-control corresponding to the identifier code is determined under the target control corresponding to the permission instruction through the CSS selector, and the permission operation is performed on the sub-control corresponding to the identifier code.
[0078] In one example, the target control corresponding to the import permission instruction includes three sub-controls of an add user control, a lock control and a remove user control, and the field values of the corresponding identification codes are ".addUser", ".addLock" and ".removeUser". When the identification codes ".addUser" and ".removeUser" are configured for the target control, and the identification code ".removeUser" is started, it indicates that the final controlled sub-control is the remove user control. When it is determined that the import permission instruction is in the unauthorized information list and the identification code is also in the unauthorized information list, the field value of the identification code is ".removeUser". The sub-control corresponding to ".removeUser" is determined to be the remove user control in the range of the import control through the CSS selector, that is, the corresponding sub-control is filtered from all sub-controls of the import control according to the identification code, and the filtered remove user control is subjected to the permission operation.
[0079] In the above example, before the sub-control in the unauthorized information list is subjected to the permission operation, the sub-control corresponding to the identification code is determined in the target control corresponding to the permission instruction through the CSS selector, that is, the sub-control is searched only in the range of the target control corresponding to the permission instruction, so that the effect of further dividing the permission control range in the determined control range is achieved, thereby making the permission range controlled by the permission method provided in the embodiment more accurate and realizing the accurate control of the control.
[0080] In the embodiment, the permission information of the user includes a mode field, and the value of the mode field is obtained through the visual configuration interface. When the value of the mode field is remove, the permission operation is remove; and when the value of the mode field is disable, the permission operation is disable. That is, the value of the mode field is determined in the visual permission configuration interface, so as to determine what kind of permission operation is performed on the target control or the sub-control corresponding to the target control.
[0081] In one example, in the visual permission configuration interface, the value of the mode field is set to remove, where remove means that the entire control is deleted from the front-end page, that is, not displayed in the front-end. When the currently rendered permission instruction is in the unauthorized information list and the configured identification code is in the unauthorized information list, the sub-control corresponding to the identification code is removed; and when the currently rendered permission instruction is in the unauthorized information list and the configured identification code is not in the unauthorized information list, the target control corresponding to the permission instruction is removed.
[0082] In another example, in the visual permission configuration interface, the value of the mode field can also be set to disabled, where disabled means that the control is displayed in a certain specific format on the front end, but the function of the control cannot be used. Then, in the case that the currently rendered permission instruction is in the unauthorized information list and the configured identification code is in the unauthorized information list, the sub-control corresponding to the identification code is disabled; in the case that the currently rendered permission instruction is in the unauthorized information list and the configured identification code is not in the unauthorized information list, the target control corresponding to the permission instruction is disabled.
[0083] In yet another example, in the visual permission configuration interface, the value of the mode field can also be set to limited times. Where limited times means that the user has a number of times of using the target control, and after exceeding the limited times, the user does not have the operation permission for the target control. In the case that the currently rendered permission instruction is in the unauthorized information list and the configured identification code is in the unauthorized information list, the sub-control corresponding to the identification code is operated with limited times; in the case that the currently rendered permission instruction is in the unauthorized information list and the configured identification code is not in the unauthorized information list, the target control corresponding to the permission instruction is operated with limited times.
[0084] It should be noted that the permission control method provided in the embodiments of the present application does not specifically limit the permission operation, that is, the value of the mode field in the visual permission configuration interface is not specifically limited. As long as the user cannot perform the related function operation on the target control corresponding to the permission instruction or the sub-control corresponding to the identification code in the case that the permission instruction or the identification code is not authorized, the specific permission operation can be determined according to actual needs.
[0085] In the embodiments of the present application, before the target page is rendered and displayed according to the permission information, when the user accesses the target page, the corresponding query SQL is generated according to the page route of the target page; the permission information of the user is queried in the database according to the query SQL. Since the permission information of the user is uniformly saved into the database, the query SQL that can query the required permission information needs to be generated according to the page route of the target page accessed before the page is rendered.
[0086] In order to make the permission control method provided in the embodiments of the present application more clear, the specific process of rendering the page according to the permission information will be described below with reference to Figure 2 , and the specific content is as follows:
[0087] In step 201, the corresponding query SQL is generated in the back end according to the page route of the target page.
[0088] In step 202, the generated query SQL is used to query the enabling information of the permission instruction in the target page in the database, the authorization information of the current user to the permission instruction in the target page is queried from the database, the permission instruction in the authorization information is removed from the permission instruction enabling information, the un-authorization information list is obtained, and the un-authorization information list is returned to the back end.
[0089] In step 203, the front end performs page rendering, when rendering to a certain permission instruction, the corresponding operation object and the value of the binding identifier are obtained according to the position of the current permission instruction and the value of the identifier field of the permission instruction, and the permission method is called.
[0090] In step 204, the permission instructions are rendered according to the permission method and the permission information.
[0091] In one example, it is judged whether the permission instruction is in the un-authorization information list, if yes, the identifier code enabled by the current rendering control is obtained, the control corresponding to the enabled identifier code is determined, and the control corresponding to the enabled identifier code is removed, if the current rendering control has no enabled identifier code, the control corresponding to the permission instruction is directly removed.
[0092] By defining the identifier field value in the meta attribute in the front-end routing configuration file and writing the business logic involved in the permission method, the defined identifier field value is placed in the permission instruction for display in the visual interface, and the user's permission information is entered in the visual permission configuration interface, the user's permission information is saved to the database, when the user accesses the page, the front end sends a data request to the back end, the back end obtains the permission information from the database and returns it to the front end, and the front end calls the corresponding business processing logic code according to the permission information, so as to realize the rendering of the permission instruction.
[0093] In the embodiment of the present application, the permission instruction is associated with a larger target control for permission control to realize larger permission range control by calling the permission instruction in each target control, and the permission control of the sub-controls of the target control is realized by configuring an identification code for each target control, so that the permission range controlled by the embodiment of the present application is more accurate; the identification field value is defined in the meta attribute in the front-end routing configuration file of the target page, so that the user can directly configure the user permission information on the visual interface, and since the permission instruction has been defined in the target page in advance and the identification code has been configured for each target control, when the user's permission information changes, the permission control function of the permission instruction and the identification code is adjusted on the visual interface, so that the permission adjustment is more flexible, the permission range adjustment process is simpler, and in addition, the permission control method provided in the embodiment of the present application ensures the consistency of the permission instruction in the front-end code and the visual configuration interface permission instruction, ensures the consistency of the permission information configured for the user on the visual configuration interface and the permission information saved in the database, so that the permission control can be accurately run.
[0094] The step division of the above various methods is only for clear description, and when implemented, one step can be combined or some steps can be split or decomposed into multiple steps, as long as the same logical relationship is included, and all are within the protection scope of the patent; adding irrelevant modifications or introducing irrelevant designs in the algorithm or process, but not changing the core design of the algorithm and process are within the protection scope of the patent.
[0095] The embodiment of the present application also relates to a permission control system, as shown in Figure 3 The system includes a declaration module 301, a definition module 302, a configuration module 303, and a rendering module 304.
[0096] Specifically, the declaration module 301 is configured to declare a permission instruction in a custom instruction initialization file, the permission instruction being used to call a permission method to control a control permission; parameters of the permission method include an operation object and a binding identifier; the definition module 302 is configured to define an identifier field value in a meta attribute in a front-end routing configuration file of a target page; the permission instruction is called in each target control, the permission instruction is used to determine that the identifier field value is an incoming parameter of the binding identifier, and the target control is an incoming parameter of the operation object; the configuration module 303 is configured to render a visual permission configuration interface according to the meta attribute, determine user permission information in the visual permission configuration interface, and save the user permission information to a database, the user permission information including first-level permission information and second-level permission information, the first-level permission information being an identifier field value corresponding to a permission instruction required by the user in the target page, and the second-level permission information being a permission of a sub-control in a target control corresponding to the permission instruction required by the user in the target page, the second-level permission information being determined by a configuration identifier code, and the identifier code being determined according to front-end code of the target page; and the rendering module 304 is configured to render and display the target page according to the permission information, wherein when the permission instruction is rendered, the operation object and the binding identifier are determined according to the permission instruction, and the permission method is called to control the permission of the target control.
[0097] In one example, the declaration module 301 declares the permission instruction in a custom initialization file, and uses a directive() method provided by VUE to establish the permission method in the embodiment of the application, which is used to specify a trigger time of the permission method, i.e., under what condition the business logic of the permission method is executed.
[0098] In one example, the definition module 302 defines the identifier field value in a routing interface of the target page, and calls each permission instruction under each target control to establish a corresponding relationship between each control and each permission instruction.
[0099] In one example, when it is necessary to configure or update the permission information of the user, the configuration module is required to start or close the permission instruction and an identifier code configured by the permission instruction in the visual permission configuration interface, so as to adjust the permission information of the user.
[0100] In one example, the rendering module 304 renders the permission instructions one by one according to the saved permission information and the permission method defined by the declaration module 301.
[0101] The access control system provided in this application declares access instructions and writes the business logic for access methods in a custom initialization file, declares identifier field values in the front-end routing configuration file, displays the access instructions corresponding to the defined identifier field values in a list format in the configuration interface, enters access information in the visual access configuration interface, and saves the access information to the database. When a user accesses a target page, the front-end sends a data request to the back-end, the back-end retrieves the access information from the database and returns it to the front-end, and the front-end calls the corresponding business processing logic code according to the access information, thereby realizing the rendering of access instructions. Furthermore, the subsequent access information maintenance process is simple; user access information can be adjusted without manual maintenance, the access control scope is precise, and the access control scope can be modified and adjusted according to actual needs.
[0102] It is not difficult to see that this embodiment is a device embodiment corresponding to the above-described permission control method embodiments, and this embodiment can be implemented in conjunction with the above-described permission control method embodiments. The relevant technical details mentioned in the above-described permission control method embodiments are still valid in this embodiment, and will not be repeated here to reduce repetition. Correspondingly, the relevant technical details mentioned in this embodiment can also be applied to the above-described permission control method embodiments.
[0103] It is worth mentioning that all modules involved in the above embodiments of this application are logical modules. In practical applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. Furthermore, to highlight the innovative aspects of this application, this embodiment does not introduce units that are not closely related to solving the technical problem proposed in this application; however, this does not mean that other units are absent from this embodiment.
[0104] Embodiments of this application also provide an electronic device, such as... Figure 4 As shown, it includes at least one processor 401; and a memory 402 communicatively connected to the at least one processor 401; wherein the memory 402 stores instructions executable by the at least one processor 401, the instructions being executed by the at least one processor 401 to enable the at least one processor to perform the above-described access control method.
[0105] The memory and the processor are connected by a bus, which can include any number of interconnecting buses and bridges, and the bus connects the various circuits of the one or more processors and the memory together. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art, and therefore, will not be described any further. A bus interface provides an interface between the bus and a transceiver. The transceiver, which can be a single element or a plurality of elements, such as a plurality of receivers and transmitters, provides a communication path for communicating with various other devices over a transmission medium. Processed data is transmitted over a wireless medium via an antenna, and further, the antenna also receives data and transfers the data to the processor.
[0106] The processor is responsible for managing the bus and general processing, and can also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. The memory can be used to store data used by the processor during execution of operations.
[0107] The product described above can execute the method provided by the embodiments of the present application, has the corresponding function modules and beneficial effects of executing the method, and the technical details not described in the embodiments can be referred to the method provided by the embodiments of the present application.
[0108] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program. The computer program is executed by the processor to implement the method embodiments described above.
[0109] Those skilled in the art can understand that all or part of the steps of the method described above can be completed by a program instructing related hardware, and the program is stored in a storage medium, including a plurality of instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the method described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various storage medium that can store program codes.
[0110] The above embodiments are provided to those skilled in the art to implement and use the present application, and those skilled in the art can make various modifications or changes to the above embodiments without departing from the inventive concept of the present application, and therefore, the protection scope of the present application should not be limited by the above embodiments, but should conform to the maximum scope of the innovative features mentioned in the claims.
Claims
1. A method of controlling rights, characterized by, The application comprises: Declaring a permission instruction in a custom instruction initialization file, which is used to call a permission method to control the permission of a control; the parameters of the permission method include an operation object and a binding identifier; Defining an identifier field value in a meta attribute in a front-end routing configuration file of a target page; calling the permission instruction in each target control, and taking the identifier field value determined by the permission instruction when it is called as the incoming parameter of the binding identifier, and taking the target control as the incoming parameter of the operation object; Rendering a visual permission configuration interface according to the meta attribute, determining the permission information of a user in the visual permission configuration interface, and saving the permission information of the user to a database; the permission information of the user includes first-level permission information and second-level permission information; the first-level permission information is the identifier field value corresponding to the permission instruction needed by the user in the target page when the permission instruction is called; the second-level permission information is the permission of a sub-control in a target control corresponding to the permission instruction needed by the user in the target page, and the second-level permission information is determined by a configuration identifier code, which is determined according to the front-end code of the target page; Rendering and displaying the target page according to the permission information, wherein when the permission instruction is rendered, the operation object and the binding identifier are determined according to the permission instruction, and the permission method is called to control the permission of the target control.
2. The method of claim 1, wherein The visual permission configuration interface comprises: An enablement configuration interface, which is rendered according to the meta attribute; An authorization configuration interface, which is rendered according to the permission instructions that have been enabled in the enablement configuration interface.
3. The method of claim 2, wherein The determination of the permission information of the user in the visual permission configuration interface comprises: In the enablement configuration interface, the permission instructions needed to be enabled in the target page are determined from the permission instructions corresponding to the identifier field values; In the authorization configuration interface, the permission instructions needed by the user in the target page are determined from the permission instructions that have been enabled, and the first-level permission information is obtained; In the enablement configuration interface, the identifier codes of the sub-controls that need to be controlled are configured for the target controls corresponding to the permission instructions, and the enabled identifier codes are determined from the configured identifier codes, and the second-level permission information is obtained.
4. The rights control method of claim 1, wherein The permission method comprises: Obtaining the permission information of the user; Obtaining an unauthorized information list according to the permission instructions in the visual permission configuration interface and the permission information of the user; Determining whether the permission instruction currently rendered is in the unauthorized information list; In the case that the permission instruction is in the unauthorized information list, obtaining the identifier codes configured for the target controls corresponding to the permission instruction; Determining whether the identifier codes configured for the target controls corresponding to the permission instruction are in the unauthorized information list; In the case that the identifier codes configured for the target controls corresponding to the permission instruction are in the unauthorized information list, performing a permission operation on the sub-controls corresponding to the identifier codes.
5. The rights control method according to claim 4, characterized by, The permission method further comprises: In a case where the identification code of the target control corresponding to the permission instruction is not in the unauthorized information list, the target control corresponding to the permission instruction is subjected to the permission operation.
6. The rights control method according to claim 4 or 5, characterized by, The permission information of the user includes a mode field, and a value of the mode field is obtained through the visual configuration interface; In a case where the value of the mode field is removal, the permission operation is removal; In a case where the value of the mode field is disabling, the permission operation is disabling.
7. The rights control method according to any one of claims 1 to 5, characterized by, The target control is a common target control, and a sub-control in the target control is a special sub-control, wherein the common target control is a target control with a permission change frequency greater than a first preset threshold; and the special sub-control is a sub-control with a permission change frequency less than a second preset threshold.
8. The rights control method according to any one of claims 1 to 5, characterized by, The method further includes controlling the permission of a URL using the identification field value and / or the identification code.
9. The method of claim 1-5, wherein, Before the target page is rendered and displayed according to the permission information, the method further includes: When the user accesses the target page, a corresponding query SQL is generated according to a page route of the target page; The permission information of the user is queried in the database according to the query SQL.
10. A rights control system, characterized by It includes: A declaration module is configured to declare a permission instruction in a custom instruction initialization file, and to call a permission method to control the permission of a control; parameters of the permission method include an operation object and a binding identification; A definition module is configured to define an identification field value in a meta attribute in a front-end route configuration file of a target page; the permission instruction is called in each target control, and the identification field value determined by the permission instruction when called is used as an input parameter of the binding identification, and the target control is used as an input parameter of the operation object; A configuration module is configured to render a visual permission configuration interface according to the meta attribute, determine permission information of a user in the visual permission configuration interface, and save the permission information of the user to a database; the permission information includes first-level permission information and second-level permission information; the first-level permission information is an identification field value corresponding to a permission instruction called by the user in the target page; and the second-level permission information is a permission of a sub-control in a target control corresponding to the permission instruction of the user in the target page; the second-level permission information is determined by a configuration identification code, and the identification code is determined according to a front-end code of the target page; A rendering module is configured to render and display the target page according to the permission information, wherein when the permission instruction is rendered, the operation object and the binding identification are determined according to the permission instruction, and the permission method is called to control the permission of the target control.
11. An electronic device, comprising: It includes: At least one processor; And A memory connected in communication with the at least one processor; wherein The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the permission control method according to any one of claims 1 to 9.
12. A computer readable storage medium storing a computer program, wherein the computer program comprises program instructions configured to cause a processor to perform the method according to any one of claims 1 to 11. The computer program, when executed by a processor, implements the permission control method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Permission configuration interface display method and device, terminal and storage medium
CN110457891A
Page rendering method and device based on dynamic authority control, equipment and medium
CN113885985A