Structured query statement construction method and system based on authority control
By judging the replacement conditions of the structured query statement uploaded by the user, and building the second structured query statement based on the pre-configured replacement rules and constraint enumeration, the problem of resource queries cannot be constrained in complex scenarios is solved, and joint query permission control for multi-resource entities is realized, avoiding the lack of permissions.
Patent Information
- Application Number
- CN202411753982.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-21
AI Technical Summary
In some business scenarios, simply querying permission control for single resource entities is difficult to limit the data query requirements in complex scenarios, resulting in the lack of permissions caused by the inability to constrain resource queries.
By receiving structured query statements uploaded by the user, it is judged for replacement conditions; when the replacement conditions are met, the pre-configured replacement rules and constraint enumeration of the target resource entity are obtained, and a second structured query statement is built based on these rules and enumerations, which is used to query the dimension table and realize joint query permission control of multi-resource entities.
It effectively avoids the lack of query permissions caused by joint query of associated resource entities, and improves the effectiveness of query permission control of multi-resource entity.
Smart Images

Figure CN119669262A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a method and system for constructing a structured query statement based on permission control. Background Art
[0002] At present, in ad hoc query scenarios, structured query language (SQL) is usually used to access data for real-time data analysis, custom query, report generation, data visualization and other services. In some business scenarios, it is necessary to control the permissions of user data queries to restrict users to query only data with corresponding permissions. For resource entities such as tables, fields, and paths, their query permissions are independently constrained. By restricting users to query corresponding resource entities, users can be restricted to query only data with corresponding permissions.
[0003] However, in many business scenarios, different resource entities (such as tables and tables or tables and columns) are associated with each other, and they need to interact with each other to complete query permission control. Simply controlling the query permission of a single resource entity is difficult to limit the data query needs in complex scenarios, and may even lead to the lack of query permission for the corresponding resource entity, affecting the business processing effect. Summary of the invention
[0004] The embodiment of the present application provides a method and system for constructing a structured query statement based on permission control, which can realize joint query permission control for multiple resource entities and solve the technical problem of missing query permissions due to joint query of related resource entities.
[0005] In a first aspect, an embodiment of the present application provides a method for constructing a structured query statement based on permission control, comprising:
[0006] Receiving a first structured query statement uploaded by a user terminal, and performing a replacement condition judgment on the first structured query statement;
[0007] In the case of judging that the first structured query statement satisfies the replacement condition, obtaining a replacement rule pre-configured for the target resource entity corresponding to the query of the first structured query statement, and determining a constraint enumeration of the user end corresponding to the target resource entity, wherein the constraint enumeration is used to limit the user end to query the specified content of the target resource entity, and the replacement rule pre-configures an associated dimension table corresponding to the specified content;
[0008] A second structured query statement is constructed based on the replacement rule and the constraint enumeration, and the second structured query statement is used to query the dimension table.
[0009] In a second aspect, an embodiment of the present application provides a system for constructing a structured query statement based on authority control, including:
[0010] A judgment module is configured to receive a first structured query statement uploaded by a user terminal, and perform a replacement condition judgment on the first structured query statement;
[0011] A rule query module is configured to obtain a pre-configured replacement rule for a target resource entity queried by the first structured query statement when it is determined that the first structured query statement satisfies a replacement condition, and determine a constraint enumeration of the target resource entity corresponding to the user end, wherein the constraint enumeration is used to limit the user end to query the specified content of the target resource entity, and the replacement rule pre-configures an associated dimension table corresponding to the specified content;
[0012] The replacement module is configured to construct a second structured query statement based on the replacement rule and constraint enumeration, and the second structured query statement is used to query the dimension table.
[0013] In a third aspect, an embodiment of the present application provides a structured query statement construction device based on permission control, including:
[0014] memory and one or more processors;
[0015] The memory is configured to store one or more programs;
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for constructing a structured query statement based on permission control as described in the first aspect.
[0017] In a fourth aspect, an embodiment of the present application provides a non-volatile computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions, when executed by a computer processor, are configured to execute the method for constructing a structured query statement based on permission control as described in the first aspect.
[0018] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes instructions. When the instructions are executed on a computer or a processor, the computer or the processor executes the method for constructing a structured query statement based on permission control as described in the first aspect.
[0019] The embodiment of the present application receives a first structured query statement uploaded by a user terminal, and judges a replacement condition for the first structured query statement; when it is judged that the first structured query statement satisfies the replacement condition, obtains a replacement rule pre-configured for the target resource entity corresponding to the query of the first structured query statement, and determines a constraint enumeration of the target resource entity corresponding to the user terminal, the constraint enumeration is used to limit the user terminal to query the specified content of the target resource entity, and the replacement rule pre-configures the dimension table associated with the specified content; a second structured query statement is constructed based on the replacement rule and the constraint enumeration, and the second structured query statement is used to query the dimension table. The above-mentioned technical means are adopted to generate a second structured query statement based on the first structured query statement using the replacement rule and the constraint enumeration, so as to use the second structured query statement to query the partial content that the user terminal has the query authority for corresponding to the target resource entity, thereby realizing the joint query authority control of multiple resource entities, avoiding the situation where the joint query of the associated resource entities leads to the loss of query authority, and thus improving the query authority control effect of multiple resource entities. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a flowchart of a method for constructing a structured query statement based on authority control provided in an embodiment of the present application;
[0021] Figure 2 It is an interactive schematic diagram of data query in an embodiment of the present application;
[0022] Figure 3 is a flowchart for constructing the second structured query statement in an embodiment of the present application;
[0023] Figure 4 It is a replacement and query flow chart of structured query statements in an embodiment of the present application;
[0024] Figure 5 It is a structural diagram of a system for constructing structured query statements based on authority control provided in an embodiment of the present application;
[0025] Figure 6 It is a structural diagram of a structured query statement construction device based on permission control provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
[0027] The method for constructing a structured query statement based on permission control provided in the present application aims to generate a second structured query statement by using replacement rules and constraint enumeration based on the first structured query statement. The second structured query statement can be used to query the partial content for which the user terminal has the query permission for the corresponding target resource entity, thereby realizing joint query permission control for multiple resource entities.
[0028] With the advent of the big data era, ad hoc query systems have become an indispensable work tool for major Internet companies. Such systems allow users to directly access data, conduct real-time data analysis, customize queries and report generation, and visualize data, greatly improving the efficiency of data processing and decision-making. However, as business volume grows, query frequency and data size also increase, prompting companies to strengthen their awareness of data management and control. To this end, data is usually classified according to security levels, which requires a complete set of data permission control solutions to adapt to this change.
[0029] In relevant permission control schemes, permission control is usually performed on tables at the data level. Permission control refers to the process of determining which resources a user or system component can access by setting rules. It is used to constrain and limit data and protect the security and integrity of data. Permission control classifies users and resources and sets the ownership of users and resources to establish connections and determine permission relationships. For example, if a user has the "Se l ect" query permission for table group 1, and table a belongs to table group 1, the mapping relationship is used to confirm that the user can query table a. In addition, the row and column restriction function can also accurately filter out data that meets the conditions. Row and column restriction refers to a method of fine-grained control of data access in a database or data warehouse, which restricts users to view only specific rows or columns.
[0030] However, this type of permission control framework is a general framework, which requires a balance between generality and complexity, because these frameworks tend to restrict resource entities that are less affected by the business, such as tables, fields, paths and other entities. And the entities are independently constrained, that is, there is no mutual constraint between tables. In fact, in many business scenarios, there are associations between tables or tables and columns, and they need to interact to complete the constraints. For example, if you need to restrict a user to query data of a certain country, you usually only need to restrict the rows of the table, but if the table does not have a country field, this permission requirement cannot be met. This constraint on a single resource entity is difficult to meet complex scenarios, and there will be a problem of missing permissions due to the inability to constrain resource queries.
[0031] Obviously, for relevant permission control schemes, if the constraints can be completed within a single entity, the general framework of this type of permission control can be satisfied. However, in more complex scenarios, such as when a table does not have a country field, it is impossible to constrain user data query permissions to row data in certain countries. Based on this, a method for constructing a structured query statement based on permission control is provided in an embodiment of the present application to solve the technical problem of missing query permissions due to joint queries of associated resource entities.
[0032] Example:
[0033] Figure 1 A flowchart of a method for constructing a structured query statement based on permission control provided in an embodiment of the present application is given. The method for constructing a structured query statement based on permission control provided in this embodiment can be executed by a structured query statement constructing device based on permission control. The structured query statement constructing device based on permission control can be implemented in software and / or hardware. The structured query statement constructing device based on permission control can be composed of two or more physical entities, or can be composed of one physical entity. Generally speaking, the structured query statement constructing device based on permission control can be a computing device such as a data query server or a data query device.
[0034] The following description is made by taking the structured query statement construction device based on authority control as an example of the subject of the structured query statement construction method based on authority control. Figure 1 The method for constructing a structured query statement based on permission control specifically includes:
[0035] S110: Receive a first structured query statement uploaded by a user terminal, and perform replacement condition determination on the first structured query statement.
[0036] This application aims to perform joint permission control of multiple resource entities in data ad hoc query scenarios. For situations where a single resource entity query cannot meet the associated permission control, the method of replacing structured query statements is adopted to increase the constraints on user data queries, thereby restricting users to query only the content for which they have query permissions.
[0037] Specifically, refer to Figure 2 , this application builds a data query and permission control architecture based on three parts: web front-end, permission service and computing engine. Among them, the web front-end service, as a UI display page, is mainly responsible for page interaction with the user side, request routing and display of result data; the permission service layer is responsible for saving and creating replacement rules and connecting to the underlying computing engine. The permission service layer constructs structured query statements based on the permission control-based structured query statement construction method of this application, and controls data query permissions by replacing SQL, so that the user side can implement data constraints without perception; the computing engine, as the provider of the underlying core computing capabilities, is mainly used to accept and process SQL generated from the permission background.
[0038] Furthermore, based on the above-mentioned data query and permission control architecture, when performing data query, the operator on the user side submits a data query request request containing the original query SQL on the web side through the browser. The request mainly contains SQL string information, which is in JSON format through the relevant interactive protocol and the permission service layer for interface call, and defines the original query SQL as the first structured query statement.
[0039] Based on receiving the first structured query statement, it is necessary to determine the replacement conditions of the structured query statement. It is understandable that if the resource entity queried by the first structured query statement needs to limit the user's data query authority, and specifically limits the user to only query which part of the content, and the first structured query statement is not configured with corresponding constraint information for limitation, then the first structured query statement needs to be replaced, and the current first structured query statement meets the replacement conditions. Otherwise, it is determined that the current first structured query statement does not meet the replacement conditions, and the authority service layer directly submits the first structured query statement to the data engine layer to obtain the corresponding queried resource entity.
[0040] Optionally, performing replacement condition judgment on the first structured query statement includes:
[0041] When it is detected that the first structured query statement does not include a constraint field corresponding to the user terminal and a preconfigured replacement rule exists for a target resource entity corresponding to the query of the first structured query statement, it is determined that the first structured query statement meets the replacement condition.
[0042] The resource entity queried by the first structured query statement is defined as the target resource entity, and the constraint field represents the specified content that limits the user to query the target resource entity. If the first structured query statement does not contain the constraint field corresponding to the user end, the data that the user can query cannot be found based on the constraint field. In addition, the permission service layer also needs to pre-configure the replacement rules corresponding to the specified content, so as to reconstruct the structured query statement through the replacement rules, so that the structured query statement can limit the user to query only the specified content. If the above conditions are met, it is judged that the first structured query statement meets the replacement conditions, and the replacement of the first structured query statement is triggered at this time, and the structured query statement that meets the query permission control of the specified content is reconstructed.
[0043] Optionally, the replacement rules are pre-built based on the target resource entity, the first structured query statement, the dimension table, and the constraint field. The replacement rule refers to a set of replacement logic that replaces the table with a subquery to expand the data constraints and implement row and column restrictions. It can be abstracted into an object entity, including information such as the original table, subquery, and constraint fields. Prior to this, the replacement rules of the structured query statement are configured accordingly according to the query permission control of each associated resource entity of the target resource entity. For example, for the query permission control of different rows and columns in a table, the user-side analyst is required to construct the replacement rules so that the structured query statement satisfies the query permission control of the corresponding row and column content.
[0044] The user-side analyst needs to create a dimension table corresponding to the content of each row and column, and trigger a rule creation request on the web side through the browser. The rule creation request contains configuration information including the original table (i.e., the target resource entity), the dimension table, the associated SQL (the first structured query statement), and the constraint fields corresponding to the specified content. The rule creation request is interfaced with the rule management module in the permission service layer through the interactive protocol in JSON format. Based on the received configuration information, the permission service layer can construct rules according to the SQL statement and create a replacement rule to use the replacement rule to replace the first structured query statement so that it meets the query permission restrictions of the specified content (i.e., the dimension table) of the target resource entity. Subsequently, the replacement condition is judged. If the replacement condition is met, the pre-configured replacement rule can be used to recreate the structured query statement.
[0045] Optionally, performing replacement condition judgment on the first structured query statement includes:
[0046] When it is detected that the role information of the user terminal meets the permission control conditions, the target resource entity meets the permission control level, the first structured query statement does not contain the constraint field corresponding to the user terminal, and there is a pre-configured replacement rule for the target resource entity corresponding to the query of the first structured query statement, it is judged that the first structured query statement meets the replacement conditions.
[0047] When judging the replacement conditions, the present application can also judge the replacement conditions in combination with the role information of the user end and the permission control level of the target resource entity. Among them, the role information of the user end is mainly contained in the user information, and the role information can include different role functions such as analyst, operation, and technology. Among them, the analyst is mainly responsible for creating replacement rules, and the operation is a role that needs to perform data query permission control. The permission control level of the target resource entity can be table level information, which is contained in the table information of the target resource entity and can be divided into different levels such as ordinary, advanced, and confidential. Among them, permission control is required for advanced and confidential data acquisition. The constraint field information is contained in the replacement rule. If you want to limit the operator to only query the data in the area to which they belong, the constraint field can be country or region, etc.
[0048] Exemplarily, when the operator submits SQL for the first time, the authority judgment module first judges the user role and table level. If it is an operation role and the queried table is high-level or confidential, the authority judgment module will further judge the replacement condition according to different conditions. Among them, if the first structured query statement contains a constraint field, that is, the original table meets the constraint conditions, and there are fields that need to be restricted for query, the original SQL (first structured query statement) can be submitted directly to the calculation engine without modification; if the first structured query statement does not contain a constraint field, but there is no corresponding replacement rule in the authority service layer. It is necessary to add a dimension table to introduce the filter field and notify the analyst to create a replacement rule; if the first structured query statement does not contain a constraint field, and there is a replacement rule. That is, the original table does not have a constraint field, but there is a replacement rule, then it is determined that the current replacement condition is met and the first structured query statement needs to be replaced.
[0049] S120. When it is determined that the first structured query statement satisfies the replacement condition, a replacement rule pre-configured for the target resource entity corresponding to the query of the first structured query statement is obtained, and a constraint enumeration corresponding to the target resource entity of the user end is determined. The constraint enumeration is used to limit the user end to query the specified content of the target resource entity, and the replacement rule pre-configures an associated dimension table corresponding to the specified content.
[0050] When it is determined that the first structured query statement meets the replacement condition, it is necessary to determine the constraint enumeration of the corresponding target resource entity based on the replacement rule and user information. The constraint enumeration is used to limit the user end to query the specified content of the target resource entity. Taking the country as a constraint field as an example, the constraint enumeration can be the name of the country to which the operator belongs. By introducing additional dimension tables and constraint fields, multi-table association between the original table and the dimension table is realized, and the constraint enumeration corresponding to the operator is determined according to the constraint field in the replacement rule. The constraint enumeration can be used to reconstruct the structured query statement, thereby realizing the constraint of the specified field content.
[0051] Optionally, determining a constraint enumeration corresponding to the target resource entity of the user terminal includes:
[0052] Obtain the constraint field from the replacement rule, query the user information of the user end based on the constraint field, and determine the constraint enumeration of the target resource entity corresponding to the user end from the user information.
[0053] Constraint enumeration is included in user information. Users have their own constraint enumeration under each constraint field. For example, for the constraint field corresponding to "country", operators can specify the country name as the constraint enumeration, which means that the user has the business data query permission for the corresponding country. It is understandable that for a table containing business data of different countries, when there is no constraint field of "country", by building a dimension table corresponding to the business data of different countries, combined with the pre-configured replacement rules and constraint enumeration, a query statement can be built to query the dimension table.
[0054] S130: Construct a second structured query statement based on the replacement rule and constraint enumeration, where the second structured query statement is used to query the dimension table.
[0055] Based on the above determined replacement rules and constraint enumeration, a structured query statement for querying the dimension table corresponding to the constraint enumeration is recreated, which is defined as the second structured query statement. The second structured query statement is submitted to the data engine layer, and the content of the dimension table can be queried accordingly, thereby realizing the joint query permission control of multiple resource entities.
[0056] The second structured query statement is constructed based on the replacement rule and constraint enumeration, including:
[0057] In the case where there are multiple replacement rules and corresponding constraint enumerations, the second structured query statement is constructed based on the user terminal selecting a target replacement rule and a corresponding target constraint enumeration from the multiple replacement rules and corresponding constraint enumerations.
[0058] When there is a replacement rule and a corresponding constraint enumeration, the second structured query statement can be directly constructed based on the replacement rule and the corresponding constraint enumeration. In actual applications, in addition to the constraint enumeration corresponding to the country, a data table can also contain different types of constraint enumerations corresponding to age, gender, etc. Different constraint enumerations can query dimension tables corresponding to different dimensions. Therefore, in the case of multiple replacement rules and corresponding constraint enumerations, the authority service layer needs to interact with the user-side operator to select the target replacement rule and the corresponding target constraint enumeration from multiple replacement rules and corresponding constraint enumerations to construct the second structured query statement.
[0059] Among them, refer to Figure 3, based on the user terminal selecting a target replacement rule and a corresponding target constraint enumeration from a plurality of replacement rules and corresponding constraint enumerations, constructing a second structured query statement, including:
[0060] S1301, output multiple replacement rules and corresponding constraint enumerations to the user end for display;
[0061] S1302, receiving selection information returned by the user terminal, and determining a target replacement rule and a corresponding target constraint enumeration from a plurality of replacement rules and corresponding constraint enumerations based on the selection information;
[0062] S1303: Construct a second structured query statement based on the target replacement rule and the corresponding target constraint enumeration.
[0063] By outputting multiple replacement rules and corresponding constraint enumerations to the user end for display, it is convenient for the user to select the dimension table of the corresponding constraint enumeration that needs to be queried according to actual needs. Then, according to the information selected by the user for the required query, the target replacement rule and the corresponding target constraint enumeration are determined from the multiple replacement rules and corresponding constraint enumerations, and the second structured query statement can be constructed.
[0064] The user side (operator) submits a request to replace the rules on the web side through the browser. The request mainly includes submission information (original SQL, rule information, enumeration of constraint fields with permissions, etc.), and makes an interface call with the permission service layer through the interactive protocol in JSON format. At this time, the replacement service implements the core logic, generates the replaced SQL, and interacts with the data engine layer through the connection service. After the front end receives the final data, it displays it.
[0065] For example, for a first structured query statement "select*from B", a replacement rule "B->select*from Ajoin B on A.id=B.id" is pre-built to replace the query on B with the query on the corresponding associated dimension table A. Based on the replacement rule and the constraint enumeration corresponding to A, a second structured query statement "select*fromB—>select*from(select*from Ajoin B on A.id=B.id)as a" can be constructed. By constructing the replacement rule, the table that cannot complete the constraint in the original SQL is replaced with a subquery that satisfies the constraint. When modifying the original SQL, while being compatible with the subquery, the performance consumption can be minimized. Subquery rules can be constructed through rule information and constraint enumeration. Specifically, the subquery can be made global by using the with method to avoid repeated queries. Then, a structured query statement pointing to A can be reconstructed through the replacement rule to realize the associated permission control of multiple resource entities. In addition, without changing the base table data, this application can functionally implement row and column restrictions, greatly reducing the human cost of changing the base table of the database, and is embedded in the overall architecture in a pluggable manner, with minimal damage to the architecture. Moreover, as long as the replacement rules are set in advance, query users can easily query the constrained data without additional SQL modification, greatly improving data query efficiency.
[0066] For example, in an ad hoc query scenario, based on business constraints, the user-side analyst configures replacement rules for tables that originally could not be constrained by fields, introduces dimension tables, and associates the dimension tables with the original tables through custom SQL. For example, a user needs to query data belonging to country a in table A, but table A lacks the country field. It is necessary to introduce country dimension table B (corresponding to country a's data) for association to form a subquery that can filter the country field. Figure 4 , then on the ad hoc query page, the user-side operator submits SQL to the permission service layer for the first time. After the permission service layer makes a permission judgment, if the replacement conditions are met, a pop-up window will inform the user that the table entity needs to be replaced with SQL, and the corresponding pre-configured replacement rules and constraint enumerations will be returned and displayed on the user page. After the user selects, the SQL is submitted again. After the SQL is submitted, the background will execute the replacement logic, and finally the engine will calculate and obtain the data.
[0067] In the above, by receiving the first structured query statement uploaded by the user end, the replacement condition of the first structured query statement is judged; when it is judged that the first structured query statement meets the replacement condition, the replacement rule pre-configured for the target resource entity corresponding to the query of the first structured query statement is obtained, and the constraint enumeration of the target resource entity corresponding to the user end is determined, the constraint enumeration is used to limit the user end to query the specified content of the target resource entity, and the replacement rule pre-configures the dimension table associated with the specified content; based on the replacement rule and the constraint enumeration, a second structured query statement is constructed, and the second structured query statement is used to query the dimension table. The above technical means are adopted to generate a second structured query statement based on the first structured query statement using the replacement rule and the constraint enumeration, so as to use the second structured query statement to query the part of the content that the user end has the query authority for corresponding to the target resource entity, so as to realize the joint query authority control of multiple resource entities, avoid the situation where the query authority is lost due to the joint query of the associated resource entities, and thus improve the query authority control effect of multiple resource entities.
[0068] Based on the above embodiments, Figure 5 A schematic diagram of a structured query statement construction system based on permission control provided by this application. Figure 5 The structured query statement construction system based on authority control provided in this embodiment specifically includes: a judgment module 21, a rule query module 22 and a replacement module 23.
[0069] The judgment module 21 is configured to receive a first structured query statement uploaded by a user terminal, and perform a replacement condition judgment on the first structured query statement;
[0070] The rule query module 22 is configured to obtain a replacement rule pre-configured for a target resource entity queried by the first structured query statement when it is determined that the first structured query statement satisfies the replacement condition, and determine a constraint enumeration of the target resource entity corresponding to the user end, the constraint enumeration is used to limit the user end to query the specified content of the target resource entity, and the replacement rule pre-configures an associated dimension table corresponding to the specified content;
[0071] The replacement module 23 is configured to construct a second structured query statement based on the replacement rule and constraint enumeration, and the second structured query statement is used to query the dimension table.
[0072] Specifically, performing replacement condition judgment on the first structured query statement includes:
[0073] When it is detected that the first structured query statement does not include a constraint field corresponding to the user terminal and a preconfigured replacement rule exists for a target resource entity corresponding to the query of the first structured query statement, it is determined that the first structured query statement meets the replacement condition.
[0074] Specifically, performing replacement condition judgment on the first structured query statement includes:
[0075] When it is detected that the role information of the user terminal meets the permission control conditions, the target resource entity meets the permission control level, the first structured query statement does not contain the constraint field corresponding to the user terminal, and there is a pre-configured replacement rule for the target resource entity corresponding to the query of the first structured query statement, it is judged that the first structured query statement meets the replacement conditions.
[0076] The replacement rule is pre-constructed based on the target resource entity, the first structured query statement, the dimension table and the constraint field.
[0077] Determine the constraint enumeration of the target resource entity corresponding to the user end, including:
[0078] Obtain the constraint field from the replacement rule, query the user information of the user end based on the constraint field, and determine the constraint enumeration of the target resource entity corresponding to the user end from the user information.
[0079] Specifically, the second structured query statement is constructed based on the replacement rule and constraint enumeration, including:
[0080] In the case where there are multiple replacement rules and corresponding constraint enumerations, the second structured query statement is constructed based on the user terminal selecting a target replacement rule and a corresponding target constraint enumeration from the multiple replacement rules and corresponding constraint enumerations.
[0081] Specifically, constructing a second structured query statement based on the user terminal selecting a target replacement rule and a corresponding target constraint enumeration from a plurality of replacement rules and corresponding constraint enumerations includes:
[0082] Output multiple replacement rules and corresponding constraint enumerations to the user end for display;
[0083] Receive selection information returned by the user end, and determine a target replacement rule and a corresponding target constraint enumeration from a plurality of replacement rules and corresponding constraint enumerations based on the selection information;
[0084] A second structured query statement is constructed based on the target replacement rule and the corresponding target constraint enumeration.
[0085] In the above, by receiving the first structured query statement uploaded by the user end, the replacement condition of the first structured query statement is judged; when it is judged that the first structured query statement meets the replacement condition, the replacement rule pre-configured for the target resource entity corresponding to the query of the first structured query statement is obtained, and the constraint enumeration of the target resource entity corresponding to the user end is determined, the constraint enumeration is used to limit the user end to query the specified content of the target resource entity, and the replacement rule pre-configures the dimension table associated with the specified content; based on the replacement rule and the constraint enumeration, a second structured query statement is constructed, and the second structured query statement is used to query the dimension table. The above technical means are adopted to generate a second structured query statement based on the first structured query statement using the replacement rule and the constraint enumeration, so as to use the second structured query statement to query the part of the content that the user end has the query authority for corresponding to the target resource entity, so as to realize the joint query authority control of multiple resource entities, avoid the situation where the query authority is lost due to the joint query of the associated resource entities, and thus improve the query authority control effect of multiple resource entities.
[0086] The structured query statement construction system based on permission control provided in the embodiment of the present application can be configured to execute the structured query statement construction method based on permission control provided in the above embodiment, and has corresponding functions and beneficial effects.
[0087] Based on the above practical example, the present application embodiment also provides a structured query statement construction device based on permission control, referring to Figure 6 , the structured query statement construction device based on permission control includes: a processor 31, a memory 32, a communication module 33, an input device 34 and an output device 35. The memory, as a computer-readable storage medium, can be configured to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the structured query statement construction method based on permission control described in any embodiment of the present application (for example, a judgment module, a rule query module and a replacement module in a structured query statement construction system based on permission control). The communication module is configured to transmit data. The processor executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory, that is, realizing the above-mentioned structured query statement construction method based on permission control. The input device can be configured to receive input digital or character information, and generate key signal input related to user settings and function control of the device. The output device may include a display device such as a display screen. The structured query statement construction device based on permission control provided above can be configured to execute the structured query statement construction method based on permission control provided in the above-mentioned embodiment, and has corresponding functions and beneficial effects.
[0088] On the basis of the above embodiments, the embodiments of the present application further provide a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores computer-executable instructions, wherein the computer-executable instructions are configured to execute a method for constructing a structured query statement based on permission control when executed by a computer processor, and the storage medium may be any of various types of memory devices or storage devices. Of course, the non-volatile computer-readable storage medium provided in the embodiments of the present application, whose computer-executable instructions are not limited to the method for constructing a structured query statement based on permission control as described above, may also execute related operations in the method for constructing a structured query statement based on permission control provided in any embodiment of the present application.
[0089] On the basis of the above embodiments, the embodiments of the present application also provide a computer program product. The technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer program product is stored in a storage medium, and includes a number of instructions for enabling a computer device, a mobile terminal or a processor therein to execute all or part of the steps of the method for constructing a structured query statement based on permission control described in each embodiment of the present application.
Claims
1. A method for constructing a structured query statement based on authority control, characterized in that: include: Receiving a first structured query statement uploaded by a user terminal, and performing replacement condition judgment on the first structured query statement; In the case of judging that the first structured query statement satisfies the replacement condition, obtaining a replacement rule pre-configured for the target resource entity queried by the first structured query statement, and determining a constraint enumeration of the user terminal corresponding to the target resource entity, wherein the constraint enumeration is used to limit the user terminal to query the specified content of the target resource entity, and the replacement rule pre-configures an associated dimension table corresponding to the specified content; A second structured query statement is constructed based on the replacement rule and the constraint enumeration, and the second structured query statement is used to query the dimension table.
2. The method for constructing a structured query statement based on authority control according to claim 1, characterized in that: The step of determining a replacement condition for the first structured query statement includes: When it is detected that the first structured query statement does not include a constraint field corresponding to the user terminal and a preconfigured replacement rule exists for a target resource entity queried by the first structured query statement, it is determined that the first structured query statement meets a replacement condition.
3. The method for constructing a structured query statement based on authority control according to claim 1, characterized in that: The step of determining a replacement condition for the first structured query statement includes: When it is detected that the role information of the user terminal meets the permission control conditions, the target resource entity meets the permission control level, the first structured query statement does not contain a constraint field corresponding to the user terminal, and there is a preconfigured replacement rule for the target resource entity corresponding to the query by the first structured query statement, it is determined that the first structured query statement meets the replacement conditions.
4. According to the method for constructing a structured query statement based on permission control in claim 2 or 3, the replacement rule is pre-constructed based on the target resource entity, the first structured query statement, the dimension table and the constraint field.
5. The method for constructing a structured query statement based on authority control according to claim 4, characterized in that: The determining of the constraint enumeration of the user terminal corresponding to the target resource entity includes: The constraint field is obtained from the replacement rule, user information of the user terminal is queried based on the constraint field, and a constraint enumeration of the user terminal corresponding to the target resource entity is determined from the user information.
6. The method for constructing a structured query statement based on authority control according to claim 1, characterized in that: The constructing a second structured query statement based on the replacement rule and the constraint enumeration includes: In the case that there are a plurality of the replacement rules and the corresponding constraint enumerations, a second structured query statement is constructed based on the user terminal selecting a target replacement rule and a corresponding target constraint enumeration from the plurality of the replacement rules and the corresponding constraint enumerations.
7. The method for constructing a structured query statement based on authority control according to claim 6, characterized in that: The selecting a target replacement rule and a corresponding target constraint enumeration from a plurality of replacement rules and corresponding constraint enumerations based on the user terminal to construct a second structured query statement includes: Outputting a plurality of the replacement rules and the corresponding constraint enumerations to the user terminal for display; receiving selection information returned by the user terminal, and determining a target replacement rule and a corresponding target constraint enumeration from a plurality of replacement rules and corresponding constraint enumerations based on the selection information; A second structured query statement is constructed based on the target replacement rule and the corresponding target constraint enumeration.
8. A structured query statement construction system based on authority control, characterized in that: include: A judgment module is configured to receive a first structured query statement uploaded by a user terminal, and perform a replacement condition judgment on the first structured query statement; A rule query module is configured to obtain a pre-configured replacement rule of a target resource entity queried by the first structured query statement when it is determined that the first structured query statement satisfies a replacement condition, and determine a constraint enumeration of the user terminal corresponding to the target resource entity, wherein the constraint enumeration is used to limit the user terminal to query a specified content of the target resource entity, and the replacement rule pre-configures an associated dimension table corresponding to the specified content; The replacement module is configured to construct a second structured query statement based on the replacement rule and the constraint enumeration, where the second structured query statement is used to query the dimension table.
9. A structured query statement construction device based on authority control, characterized in that: include: memory and one or more processors; The memory is configured to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for constructing a structured query statement based on permission control as described in any one of claims 1-7.
10. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a computer processor, they are configured to execute the method for constructing a structured query statement based on permission control as described in any one of claims 1 to 7.
11. A computer program product, characterized in that The computer program product includes instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes the method for constructing a structured query statement based on permission control as described in any one of claims 1 to 7.