CN116776345A - Data authority setting method, device, equipment and storage medium - Google Patents

Data authority setting method, device, equipment and storage medium Download PDF

Info

Publication number
CN116776345A
CN116776345A CN202310648163.XA CN202310648163A CN116776345A CN 116776345 A CN116776345 A CN 116776345A CN 202310648163 A CN202310648163 A CN 202310648163A CN 116776345 A CN116776345 A CN 116776345A
Authority
CN
China
Prior art keywords
target
data
rules
dimension
access request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310648163.XA
Other languages
Chinese (zh)
Inventor
刘正中
刘昌钰
袁奇林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengcaiyun Co ltd
Original Assignee
Zhengcaiyun Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengcaiyun Co ltd filed Critical Zhengcaiyun Co ltd
Priority to CN202310648163.XA priority Critical patent/CN116776345A/en
Publication of CN116776345A publication Critical patent/CN116776345A/en
Pending legal-status Critical Current

Links

Landscapes

  • Storage Device Security (AREA)

Abstract

The invention discloses a data authority setting method, a device, equipment and a storage medium; in the scheme, the data authority is abstracted into the data rules, if the requirement of change is required, the dimensionality, the condition rule and the dimensionality fixed value in the data rules can be subjected to self-defined modification, so that the data authority can be adjusted without readjusting the codes by a developer, and the flexibility of setting the data authority is improved; in addition, the scheme can be used for butting a plurality of service parties, each service party can configure the data rule of the role for the user according to the requirement, and the coupling of the data authority setting is improved.

Description

一种数据权限设置方法、装置、设备及存储介质A data permission setting method, device, equipment and storage medium

技术领域Technical field

本发明涉及数据权限设置领域,更具体地说,涉及一种数据权限设置方法、装置、设备及存储介质。The present invention relates to the field of data permission setting, and more specifically, to a data permission setting method, device, equipment and storage medium.

背景技术Background technique

在互联网系统中,权限一般分为功能权限和数据权限,功能权限比较常见,因为通用性和复用性,业内有很多的通用框架和设计。但对应数据权限来说,由于数据权限强依赖客户组织架构和具体业务的关系,往往实现起来会比较复杂,很少有一个设计架构能完全覆盖住,所以大部分的系统都一致性的采用非必要的不用数据权限、必须要的单独控制这一策略。In Internet systems, permissions are generally divided into functional permissions and data permissions. Functional permissions are more common. Because of their versatility and reusability, there are many common frameworks and designs in the industry. But for data permissions, since data permissions strongly depend on the relationship between the customer's organizational structure and specific business, it is often more complicated to implement. There is rarely a design architecture that can completely cover it, so most systems use non-standard systems consistently. Data permissions are not required if necessary, and this policy is controlled individually if necessary.

目前常见数据权限设置方案为硬编码,具体分为如下两种:一是拆分功能页面,即根据不同数据权限用户,通过复制拷贝的方式,增加多个类似的菜单,再通过功能权限配置来给不同用户设置不同的菜单,从而实现数据权限的控制;二是在功能对应的后端接口里做判断,对不同数据权限的用户,过滤不同的数据列表透出给用户。硬编码的方式显而易见的优点是技术难度低,实现简单。但以上硬编码的方式,无论选择用哪一种,都无法解决系统灵活性的问题,每当系统有老的需求要变更或者新的需求要新增,对应的开发人员就不得不去调整编码,修改菜单和页面,由此可见,硬编码对开发的成本和运维的成本都比较高。与此同时,行业内常见的通用数据权限控制,大都是给单一业务使用,和业务耦合度较高,可能在当前业务客户端是通用可扩展的,但是在另一个业务客户端就无法做到无缝接入了。At present, common data permission setting schemes are hard-coded, which are divided into the following two types: one is to split the function page, that is, according to users with different data permissions, multiple similar menus are added by copying, and then configured through function permissions. Set different menus for different users to control data permissions; second, make judgments in the back-end interface corresponding to the function, and filter different data lists to users with different data permissions. The obvious advantages of the hard-coding method are low technical difficulty and simple implementation. However, no matter which one of the above hard-coding methods is chosen, it cannot solve the problem of system flexibility. Whenever the system has old requirements that need to be changed or new requirements need to be added, the corresponding developers have to adjust the coding. , modify menus and pages. It can be seen that hard coding has relatively high development costs and operation and maintenance costs. At the same time, common data permission controls common in the industry are mostly used by a single business and are highly coupled with the business. They may be universal and scalable on the current business client, but cannot be done on another business client. Seamlessly connected.

因此,如何提高数据权限设置的灵活性及耦合性,是本领域技术人员需要解决的问题。Therefore, how to improve the flexibility and coupling of data permission settings is a problem that those skilled in the art need to solve.

发明内容Contents of the invention

本发明的目的在于提供一种数据权限设置方法、装置、设备及存储介质,以提高数据权限设置的灵活性及耦合性。The purpose of the present invention is to provide a data permission setting method, device, equipment and storage medium to improve the flexibility and coupling of data permission setting.

为实现上述目的,本发明提供的一种数据权限设置方法,包括:In order to achieve the above purpose, the present invention provides a data permission setting method, including:

确定每个业务方的目标功能;Determine the target functions of each business party;

设置与每个目标功能对应的目标维度;Set the target dimensions corresponding to each target function;

设置与所述目标维度对应的目标条件规则及目标维度固定值,得到每个目标功能的数据规则;Set the target condition rules and target dimension fixed values corresponding to the target dimensions to obtain the data rules for each target function;

为每个角色设置具有对应关系的目标数据规则,以便用户基于角色的目标数据规则访问对应的目标功能。Set target data rules with corresponding relationships for each role so that users can access the corresponding target functions based on the role's target data rules.

优选地,所述确定每个业务方的目标功能之后,还包括:Preferably, after determining the target function of each business party, the method further includes:

接收业务方的管理员设置的自定义维度选择项,和/或自定义维度固定值选择项。Receive custom dimension selections set by the business party's administrator, and/or custom dimension fixed value selections.

优选地,所述设置与每个目标功能对应的目标维度,包括:Preferably, the target dimensions corresponding to each target function are set, including:

基于通用维度选择项和/或所述自定义维度选择项,设置每个目标功能的目标维度。Set the target dimensions for each target feature based on the universal dimension selection and/or the custom dimension selection.

优选地,设置与所述目标维度对应的目标维度固定值,包括:Preferably, setting a fixed value of the target dimension corresponding to the target dimension includes:

基于通用维度固定值选择项和/或所述自定义维度固定值选择项,设置与所述目标维度对应的目标维度固定值。Based on the general dimension fixed value selection item and/or the custom dimension fixed value selection item, a target dimension fixed value corresponding to the target dimension is set.

优选地,所述用户基于角色的目标数据规则访问对应的目标功能,包括:Preferably, the user accesses corresponding target functions based on role-based target data rules, including:

获取访问请求;所述访问请求为用户访问目标功能的请求;Obtain the access request; the access request is the user's request to access the target function;

判断与所述访问请求对应的目标功能接口是否为权限接口;Determine whether the target functional interface corresponding to the access request is a permission interface;

若是,则确定所述用户的所有角色的数据规则,并根据所述数据规则对所述访问请求修改后,基于修改后的访问请求访问对应的目标功能。If so, the data rules for all roles of the user are determined, and the access request is modified according to the data rules, and the corresponding target function is accessed based on the modified access request.

优选地,所述确定所述用户的所有角色的数据规则,包括:Preferably, the data rules for determining all roles of the user include:

获取所述访问请求的上下文信息;Obtain contextual information of the access request;

根据所述上下文信息确定所述用户的所有角色的数据规则。Data rules for all roles of the user are determined based on the contextual information.

优选地,所述根据所述数据规则对所述访问请求修改,包括:Preferably, the modification of the access request according to the data rules includes:

若所述访问请求使用的是MyBatis的XML原生语句,则将所述数据规则封装成对应的SQL片段,并将所述SQL片段注入所述访问请求;If the access request uses the XML native statement of MyBatis, encapsulate the data rules into corresponding SQL fragments, and inject the SQL fragments into the access request;

若所述访问请求使用的是MyBatis-plus的QueryWrapper方式,则将所述数据规则注入所述访问请求的QueryWrapper条件中。If the access request uses the QueryWrapper method of MyBatis-plus, the data rule is injected into the QueryWrapper condition of the access request.

为实现上述目的,本发明进一步提供一种数据权限设置装置,包括:In order to achieve the above object, the present invention further provides a data permission setting device, including:

功能确定模块,用于确定每个业务方的目标功能;Function determination module, used to determine the target functions of each business party;

第一设置模块,用于设置与每个目标功能对应的目标维度;The first setting module is used to set the target dimensions corresponding to each target function;

第二设置模块,用于设置与所述目标维度对应的目标条件规则及目标维度固定值,得到每个目标功能的数据规则;The second setting module is used to set the target condition rules and target dimension fixed values corresponding to the target dimensions, and obtain the data rules of each target function;

第三设置模块,用于为每个角色设置具有对应关系的目标数据规则,以便用户基于角色的目标数据规则访问对应的目标功能。The third setting module is used to set target data rules with corresponding relationships for each role, so that users can access corresponding target functions based on the target data rules of the role.

为实现上述目的,本发明进一步提供一种电子设备,包括:To achieve the above object, the present invention further provides an electronic device, including:

存储器,用于存储计算机程序;Memory, used to store computer programs;

处理器,用于执行所述计算机程序时实现上述数据权限设置方法的步骤。A processor, configured to implement the steps of the above data permission setting method when executing the computer program.

为实现上述目的,本发明进一步提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现上述数据权限设置方法的步骤。In order to achieve the above object, the present invention further provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned data permission setting method are implemented.

通过以上方案可知,本发明实施例提供的一种数据权限设置方法、装置、设备及存储介质;在本方案中,该数据权限设置方案可对接多个业务方,在设置数据权限时,需要确定业务方的目标功能,针对每个目标功能,需要设置对应的目标维度、目标条件规则及目标维度固定值,以得到每个目标功能的数据规则,多个数据权限组成的控制范围即为数据权限;然后为每个角色设置具有对应关系的目标数据规则,以便用户基于角色的目标数据规则访问对应的目标功能。可见,本方案将数据权限抽象成数据规则后,若需要变更需求,则可对数据规则中的维度、条件规则及维度固定值进行自定义修改,即可调整数据权限,无需开发人员重新调整编码,提高数据权限设置的灵活性;并且,本方案可对接多个业务方,每个业务方可根据需求为用户配置角色的数据规则,提高了数据权限设置的耦合性。It can be seen from the above solution that embodiments of the present invention provide a data permission setting method, device, equipment and storage medium; in this solution, the data permission setting solution can interface with multiple business parties. When setting data permissions, it is necessary to determine For each target function of the business party, the corresponding target dimensions, target condition rules and target dimension fixed values need to be set to obtain the data rules for each target function. The control scope composed of multiple data permissions is the data permissions. ; Then set target data rules with corresponding relationships for each role so that users can access the corresponding target functions based on the role's target data rules. It can be seen that after this solution abstracts data permissions into data rules, if the requirements need to be changed, the dimensions, condition rules and dimension fixed values in the data rules can be customized and modified to adjust the data permissions without the need for developers to readjust the coding. , improving the flexibility of data permission settings; moreover, this solution can be connected to multiple business parties, and each business party can configure role data rules for users according to needs, improving the coupling of data permission settings.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only These are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without exerting creative efforts.

图1为现有方案中的数据权限设置方案整体结构图;Figure 1 is the overall structure diagram of the data permission setting scheme in the existing scheme;

图2为本发明实施例公开的一种数据权限设置方法流程图;Figure 2 is a flow chart of a data permission setting method disclosed in an embodiment of the present invention;

图3为本发明实施例公开的一种权限模型示意图;Figure 3 is a schematic diagram of a permission model disclosed in an embodiment of the present invention;

图4为本发明实施例公开的数据规则模型示意图;Figure 4 is a schematic diagram of a data rule model disclosed in an embodiment of the present invention;

图5为本发明实施例公开的数据权限设置整体模型示意图;Figure 5 is a schematic diagram of the overall model of data permission setting disclosed in the embodiment of the present invention;

图6为本发明实施例公开的业务方接入总体流程示意图;Figure 6 is a schematic diagram of the overall process of business party access disclosed in the embodiment of the present invention;

图7为本发明实施例公开的数据权限设置整体流程图;Figure 7 is an overall flow chart of data permission setting disclosed in the embodiment of the present invention;

图8为本发明实施例公开的一种数据权限设置装置结构示意图;Figure 8 is a schematic structural diagram of a data permission setting device disclosed in an embodiment of the present invention;

图9为本发明实施例公开的一种电子设备结构示意图。Figure 9 is a schematic structural diagram of an electronic device disclosed in an embodiment of the present invention.

具体实施方式Detailed ways

参见图1,为现有方案中的数据权限设置方案整体结构图;通过图1可以看出,传统方案是按照功能权限的逻辑设置数据权限,也是基于角色进行控制,在该方式下,所有要控制的业务数据分别对应建立不同的角色,给用户赋予不同的角色,在查询数据的时候根据用户所拥有的角色不同,展示不同的数据。该方案的缺点主要有:Refer to Figure 1, which is the overall structure diagram of the data permission setting scheme in the existing scheme. It can be seen from Figure 1 that the traditional scheme sets data permissions according to the logic of functional permissions and is also controlled based on roles. In this way, all required The controlled business data corresponds to different roles, and different roles are assigned to users. When querying data, different data is displayed according to the different roles the users have. The main disadvantages of this solution are:

1、该方案仅基于角色确定数据权限,丧失了其他控制维度,某些数据权限控制需求是难以实现的,如:不同部门的同一角色的数据权限一致,这就导致无法对不同部门的同一角色的数据权限进行分别控制;1. This solution only determines data permissions based on roles and loses other control dimensions. Some data permission control requirements are difficult to achieve. For example, the data permissions of the same role in different departments are consistent, which makes it impossible to control the same role in different departments. Data permissions are controlled separately;

2、运营困难,如果控制的粒度很细,且控制的范围比较多,则需要建立大量的角色控制,会发生角色爆炸的问题;2. Operation is difficult. If the granularity of control is very fine and the scope of control is large, a large number of role controls need to be established, and the problem of role explosion will occur;

3、初始赋权工作量巨大;3. The initial empowerment workload is huge;

4、无法快速接入不同的业务方。4. Unable to quickly access different business parties.

为了解决上述问题,本发明公开了一种数据权限设置方法、装置、设备及存储介质,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to solve the above problems, the present invention discloses a data permission setting method, device, equipment and storage medium. The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only some of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of the present invention.

参见图2,本发明实施例提供的一种数据权限设置方法流程图,该包括:Referring to Figure 2, a flow chart of a data permission setting method provided by an embodiment of the present invention includes:

S101、确定每个业务方的目标功能;S101. Determine the target functions of each business party;

具体来说,本方案可对接多个业务方,每个业务方首先需要确定哪些功能需要进行数据权限的控制,在本方案中,将需要接入数据权限的功能称为目标功能,如:若业务方认为查看订单这一功能需要控制,则查看订单这一功能即为目标功能;目标功能为数据权限的最细粒度,本方案可根据实际需求自定义设置多个目标功能,在此并不具体限定。Specifically, this solution can be connected to multiple business parties. Each business party first needs to determine which functions require data permission control. In this solution, the functions that require access to data permissions are called target functions, such as: If If the business party believes that the function of viewing orders needs to be controlled, then the function of viewing orders is the target function; the target function is the finest granularity of data permissions. This solution can customize multiple target functions according to actual needs. This is not the case. Specific limitations.

S102、设置与每个目标功能对应的目标维度;S102. Set the target dimensions corresponding to each target function;

参见图3,为本发明实施例提供的一种权限模型示意图;通过图3可以看出,本方案对接多个业务方,每个业务方下包括多个功能,每个功能下设置多个维度,在本方案中,数据权限实际就是控制每个维度,维度最终对应的是每个功能业务数据的筛选字段,在本实施例中,该维度不仅仅包括角色,还包括部门、岗位等等。本方案为了区分,将与目标功能对应的维度称为目标维度;由于不同业务方的业务结构不同,因此本方案可预先针对不同的业务方设置不同的维度,还可向业务方提供自定义维度选择项端口,业务方的管理人员可通过该自定义维度选择项端口设置自定义维度选择项,以便在设置权限时,通过自定义维度选择项确定目标维度。Refer to Figure 3, which is a schematic diagram of a permission model provided by an embodiment of the present invention; it can be seen from Figure 3 that this solution interfaces with multiple business parties, each business party includes multiple functions, and multiple dimensions are set under each function. , In this solution, data permissions actually control each dimension. The dimensions ultimately correspond to the filtering fields of each functional business data. In this embodiment, this dimension not only includes roles, but also includes departments, positions, etc. In order to distinguish this solution, the dimensions corresponding to the target functions are called target dimensions; since different business parties have different business structures, this solution can set different dimensions for different business parties in advance, and can also provide customized dimensions to the business parties. Selection port. Business side managers can use this custom dimension selection port to set custom dimension selections so that when setting permissions, the target dimensions can be determined through the custom dimension selections.

S103、设置与目标维度对应的目标条件规则及目标维度固定值,得到每个目标功能的数据规则;S103. Set the target condition rules and target dimension fixed values corresponding to the target dimensions, and obtain the data rules for each target function;

参见图4,为本发明实施例提供的数据规则模型示意图;通过图4可以看出,该条件规则至少包括:大于、大于等于、小于、小于等于、等于、包含、不等于;在本实施例中,为了进行区分,将目标维度设置的条件规则称为目标条件规则。该目标维度固定值为维度的具体值,如:维度为部门,则与该维度对应的维度固定值为:A部门;在本实施例中,为了进行区分,将与目标维度对应的维度固定值称为目标维度固定值,本方案中的维度固定值也可让用户通过手动输入的方式自定义设置。本方案中的数据规则由:目标维度+目标条件规则+目标维度固定值组成,业务数据的数据权限就是由多个数据规则组成的范围控制。例如:若目标功能为“查看订单”,且该功能仅允许A部门的员工查看,则与该目标功能对应的目标维度为“部门”,与该目标维度对应的目标条件规则为“等于”,与该目标维度对应的目标维度固定值为“A部门”,设置完目标维度、目标条件规则及目标维度固定值后,即可得到目标功能的一个数据规则为:A部门的员工具有查看订单数据的权限。Refer to Figure 4, which is a schematic diagram of a data rule model provided by an embodiment of the present invention; it can be seen from Figure 4 that the conditional rules at least include: greater than, greater than or equal to, less than, less than or equal to, equal to, containing, and not equal to; in this embodiment , in order to distinguish, the conditional rules set by the target dimension are called target conditional rules. The target dimension fixed value is the specific value of the dimension. For example, if the dimension is department, then the dimension fixed value corresponding to the dimension is: A department; in this embodiment, in order to distinguish, the dimension fixed value corresponding to the target dimension is Called the target dimension fixed value, the dimension fixed value in this solution can also be customized by users through manual input. The data rules in this solution are composed of: target dimension + target condition rule + target dimension fixed value. The data permissions of business data are scope control composed of multiple data rules. For example: If the target function is "View Orders" and this function is only allowed to be viewed by employees in department A, then the target dimension corresponding to the target function is "Department", and the target condition rule corresponding to the target dimension is "equal to". The fixed value of the target dimension corresponding to the target dimension is "Department A". After setting the target dimension, target condition rules and the fixed value of the target dimension, you can get a data rule for the target function: employees of department A have the ability to view order data permission.

S104、为每个角色设置具有对应关系的目标数据规则,以便用户基于角色的目标数据规则访问对应的目标功能。S104. Set target data rules with corresponding relationships for each role, so that users can access corresponding target functions based on the target data rules of the role.

在本实施例中,为各功能设置多个数据规则后,即可为各角色设置具有对应关系的数据规则,在本实施例中,将与角色具有对应关系的数据规则称为目标数据规则。通过上述设置后,每个角色对应每个功能下就挂着多个数据规则,当用户访问具体功能时,根据用户角色的数据规则,返回对应数据。参见图5,为本发明实施例提供的数据权限设置整体模型示意图,通过图5可以看出,经过设置后,每个员工可以有多个角色,每个角色对应多个功能,每个功能下有多个维度,每个维度下有多个数据规则,与功能对应的api(ApplicationProgramming Interface,应用程序接口)为用户访问功能的接口。参见图6,为本发明实施例提供的业务方接入总体流程示意图,通过该图看以看出,产品提出接入需求确定功能及维度,开发在运营管理端配置数据权限,包括功能的维度、表达式、固定值等等,供应商配置角色对应数据权限。In this embodiment, after setting multiple data rules for each function, data rules with corresponding relationships can be set for each role. In this embodiment, the data rules with corresponding relationships with roles are called target data rules. After the above settings, each role has multiple data rules corresponding to each function. When the user accesses a specific function, the corresponding data is returned according to the data rules of the user role. Refer to Figure 5, which is a schematic diagram of the overall model of data permission setting provided by the embodiment of the present invention. It can be seen from Figure 5 that after setting, each employee can have multiple roles, and each role corresponds to multiple functions. Under each function, There are multiple dimensions, and there are multiple data rules under each dimension. The API (Application Programming Interface) corresponding to the function is the interface for users to access the function. Refer to Figure 6, which is a schematic diagram of the overall process of business party access provided by the embodiment of the present invention. From this figure, it can be seen that the product proposes access requirements to determine the functions and dimensions, and the development configures data permissions on the operation management end, including the dimensions of the functions. , expressions, fixed values, etc., the supplier configuration role corresponds to the data permissions.

具体来说,在本方案中,运营登录数据权限配置端,设置每个角色的数据规则后,用户访问具体功能时,即可根据用户的角色获得对应的数据规则,并根据该数据规则组装业务数据返回。例如:数据规则为:A部门的员工具有查看订单数据的权限,将该规则与角色1设置对应关系,那么B部门具有角色1的用户1在查看订单数据时,由于角色1的数据规则限定了只有A部门的员工能看,因此B部门的用户1无法获取订单数据。Specifically, in this solution, the login data permission configuration terminal is operated. After setting the data rules for each role, when the user accesses specific functions, the corresponding data rules can be obtained according to the user's role, and the business can be assembled based on the data rules. Data is returned. For example: the data rule is: employees in department A have the permission to view order data, and set the corresponding relationship between this rule and role 1, then when user 1 with role 1 in department B views order data, due to the data rules of role 1, Only employees in department A can see it, so user 1 in department B cannot get the order data.

在本方案中,根据大部分的业务需求,抽象出功能、维度、数据规则等通用的模型,可基本做到和具体业务解耦,兼容大部分需求场景。并且,本方案将数据权限抽象成数据规则后,若需要变更需求,则可对数据规则中的维度、条件规则及维度固定值进行自定义修改,即可调整数据权限,无需开发人员重新调整编码,提高数据权限设置的灵活性;并且,本方案可对接多个业务方,每个业务方可根据需求为用户配置角色的数据规则,提高了数据权限设置的耦合性。In this solution, based on most business needs, general models such as functions, dimensions, and data rules are abstracted, which can basically decouple them from specific businesses and be compatible with most demand scenarios. Moreover, after this solution abstracts data permissions into data rules, if the requirements need to change, the dimensions, condition rules and dimension fixed values in the data rules can be customized and modified to adjust the data permissions without the need for developers to readjust the coding. , improving the flexibility of data permission settings; moreover, this solution can be connected to multiple business parties, and each business party can configure role data rules for users according to needs, improving the coupling of data permission settings.

基于上述实施例,在本实施例中,确定每个业务方的目标功能之后,还包括:接收业务方的管理员设置的自定义维度选择项,和/或自定义维度固定值选择项。相对应的,本实施例中,可基于通用维度选择项和/或自定义维度选择项,设置每个目标功能的目标维度。可基于通用维度固定值选择项和/或自定义维度固定值选择项,设置与目标维度对应的目标维度固定值。Based on the above embodiment, in this embodiment, after determining the target function of each business party, the method further includes: receiving custom dimension selection items set by the administrator of the business party, and/or custom dimension fixed value selection items. Correspondingly, in this embodiment, the target dimension of each target function can be set based on the general dimension selection item and/or the custom dimension selection item. The target dimension fixed value corresponding to the target dimension can be set based on the universal dimension fixed value selection and/or the custom dimension fixed value selection.

具体来说,通用维度选择项和通用维度固定值选择项中包括可满足大部分业务需求的维度及维度固定值,但是,由于不同业务方的业务结构不同,因此通用的维度及维度固定值可能会不满足具体的业务需求,因此在本方案中,提供开放端口给业务方,业务方可基于该端口自定义设置自定义维度选择项和/或自定义维度固定值选择项,每个自定义维度选择项对应一个自定义的维度,每个自定义维度固定值选择项对应一个维度固定值;那么在设置数据规则时,不仅仅可从通用维度选择项和通用维度固定值选择项中选择目标维度及目标维度固定值,还可从自定义维度选择项及自定义维度固定值选择项中选择目标维度及目标维度固定值。Specifically, the universal dimension options and universal dimension fixed value options include dimensions and dimension fixed values that can meet most business needs. However, due to the different business structures of different business parties, the universal dimensions and dimension fixed values may Will not meet specific business needs, so in this solution, an open port is provided to the business party, and the business party can customize the custom dimension selection items and/or the custom dimension fixed value selection items based on the port. Each custom The dimension selection item corresponds to a custom dimension, and each custom dimension fixed value selection item corresponds to a dimension fixed value; then when setting data rules, you can not only select the target from the general dimension selection items and general dimension fixed value selection items Dimension and target dimension fixed value. You can also select the target dimension and target dimension fixed value from the custom dimension selection and custom dimension fixed value selection.

也就是说:本方案依据权限模型,由运营配置对应业务使用的功能在维度的固定值,最终配置生成功能对应的数据规则;再由每个业务端的系统管理员默认赋值该功能下所有数据控制权限,由系统管理员创建角色,并给各个角色开通合适数据权限。进而,本方案还提供权限SDK(oftware Development Kit,软件开发工具包),该SDK为业务方接入的入口,是真正实现数据权限设置及控制的模块,SDK提供了用户自定义维度及固定值的端口,业务方只要实现该端口,就可使用自定义维度选择项及自定义维度固定值选择项给用户配置角色,从而突破性的解决了其他数据控制装置耦合业务较高,无法支持多应用(该应用特指不同业务背景的服务)的困境,真正做到多应用通用。That is to say: this solution is based on the permission model. The operation configures the fixed value of the function used by the corresponding business in the dimension, and finally configures and generates the data rules corresponding to the function; then the system administrator of each business end assigns all data controls under this function by default. Permissions, the system administrator creates roles and grants appropriate data permissions to each role. Furthermore, this solution also provides permission SDK (oftware Development Kit), which is the entry point for business parties to access and is a module that truly realizes data permission setting and control. The SDK provides user-defined dimensions and fixed values. Port, as long as the business party implements this port, it can use custom dimension options and custom dimension fixed value options to configure roles for users, thereby breaking through the problem that other data control devices have high coupling services and cannot support multiple applications. (This application specifically refers to services with different business backgrounds), and is truly universal for multiple applications.

基于上述任意实施例,在本实施例中,用户基于角色的目标数据规则访问对应的目标功能这一过程,具体包括如下内容:获取访问请求;访问请求为用户访问目标功能的请求;判断与访问请求对应的目标功能接口是否为权限接口;若是,则确定用户的所有角色的数据规则,并根据数据规则对访问请求修改后,基于修改后的访问请求访问对应的目标功能。Based on any of the above embodiments, in this embodiment, the process of the user accessing the corresponding target function based on the role's target data rules specifically includes the following content: obtaining an access request; the access request is a request for the user to access the target function; judging and accessing Whether the target function interface corresponding to the request is a permission interface; if so, determine the data rules for all roles of the user, modify the access request according to the data rules, and access the corresponding target function based on the modified access request.

具体来说,SDK提供自定义注解,接入方实现该注解控制每个具体功能接口是否生效,若该接口生效,则认定访问该接口时需要控制数据权限,若该接口不生效,则认定访问该接口时不需要控制数据权限;在本实施例中,默认在运营管理端配置的API会控制数据权限,可通过注解关闭,如图5所示,此时运营管理端配置的功能对应的API即为需要控制数据权限的接口,在本实施例中,将需要控制数据权限的接口称为权限接口。因此在本方案中,SDK拦截访问请求后,可通过正则匹配运营配置的权限API,若未匹配到,则说明该访问请求所请求的接口,并不是被控制数据权限的权限接口,此时可直接放行该访问请求,允许用户直接获取对应的业务数据;若匹配到,则说明该访问请求所请求的接口是被控制数据权限的权限接口,此时需要获取访问请求的上下文信息,并根据上下文信息确定用户的所有角色的数据规则。Specifically, the SDK provides custom annotations. The access party implements this annotation to control whether each specific functional interface is effective. If the interface is effective, it is deemed that data permissions need to be controlled when accessing the interface. If the interface is not effective, the access is deemed to be This interface does not need to control data permissions; in this embodiment, the API configured on the operation management side will control data permissions by default, which can be turned off through annotations, as shown in Figure 5. At this time, the API corresponding to the function configured on the operation management side That is, it is an interface that needs to control data permissions. In this embodiment, the interface that needs to control data permissions is called a permission interface. Therefore, in this solution, after the SDK intercepts the access request, it can match the permission API of the operation configuration through regular expressions. If it is not matched, it means that the interface requested by the access request is not the permission interface of the controlled data permission. At this time, you can Directly release the access request, allowing the user to directly obtain the corresponding business data; if matched, it means that the interface requested by the access request is the permission interface of the controlled data permission. At this time, it is necessary to obtain the context information of the access request, and based on the context Information determines the data rules for all roles of the user.

需要说明的是,SDK具有上下文端口,接入方需实现这个端口,根据当前缓存用户封装数据权限上下文,根据上下文可确定用户的角色,该上下文包括业务结构,如:包括几个部门、具体是什么部门等等;SDK在确定用户的所有角色的数据规则时,便可根据该上下文端口获取当前访问请求的上下文信息,根据上下文信息确定对应用户的所有角色,进而确定所有角色的数据权限,该数据权限即为与角色有对应关系的数据规则。It should be noted that the SDK has a context port, and the access party needs to implement this port to encapsulate the data permission context according to the current cached user. The user's role can be determined based on the context. The context includes the business structure, such as: including several departments, specifically What department, etc.; when the SDK determines the data rules of all roles of the user, it can obtain the context information of the current access request based on the context port, determine all roles corresponding to the user based on the context information, and then determine the data permissions of all roles. Data permissions are data rules corresponding to roles.

在本实施例中,若访问请求使用的是MyBatis的XML(Extensible MarkupLanguage,可扩展标记语言)原生语句,则将数据规则封装成对应的SQL(Structured QueryLanguage,数据库语言)片段,并将SQL片段注入访问请求;若访问请求使用的是MyBatis-plus的QueryWrapper(构造器)方式,则将数据规则注入访问请求的QueryWrapper条件中。业务方使用修改后的访问请求(SDK注入的SQL或者QueryWrapper)查询的数据,即为控制了数据权限后的数据。其中:MyBatis是一个基于Java(编程语言)的持久层框架,支持定制化SQL、存储过程以及高级映射。MyBatis-Plus:MyBatis-Plus(opens new window)(简称MP)是一个MyBatis(opens new window)的增强工具,在MyBatis的基础上只做增强不做改变,为简化开发、提高效率而生。In this embodiment, if the access request uses MyBatis's XML (Extensible Markup Language, extensible markup language) native statement, the data rules are encapsulated into corresponding SQL (Structured Query Language, database language) fragments, and the SQL fragments are injected Access request; if the access request uses the QueryWrapper (constructor) method of MyBatis-plus, then inject the data rules into the QueryWrapper condition of the access request. The data queried by the business party using the modified access request (SQL or QueryWrapper injected by the SDK) is the data after controlling the data permissions. Among them: MyBatis is a persistence layer framework based on Java (programming language), supporting customized SQL, stored procedures and advanced mapping. MyBatis-Plus: MyBatis-Plus(opens new window) (referred to as MP) is an enhancement tool for MyBatis(opens new window). Based on MyBatis, it only enhances without making changes. It is born to simplify development and improve efficiency.

需要说明的是,SDK还内置了用户端获取数据权限配置和配置数据权限的rest接口,用户管理员在页面配置数据权限时,请求接入服务方,服务方根据请求正则模糊匹配,走入内置接口,查询数据权限列表和维度选择项,用户管理员基于维度选择项配置角色的数据规则后,会通过选择项端口读取选择的具体配置结果,并调用内置保存接口保存对应配置结果。参见图7,为本发明实施例提供的数据权限设置整体流程图,通过该图可以看出,用户在页面登陆查看数据权限设置后,SDK会调用服务方获取数据权限配置信息,服务方根据参数获取业务方的数据权限配置,SDK根据开放端口封装选择项信息,并在页面展示数据权限列表,用户根据页面展示的内容配置权限(该配置权限的过程包括为各角色设置数据规则的过程),SDK根据开放端口封装配置,服务方保存对应数据权限配置,并将配置结果返回给用户查看;若用户想要查看具体功能,SDK会调用服务方获取SQL接口,服务方组装功能的数据权限配置,SDK自动拼接查询SQL,并将查询的业务数据进行展示。It should be noted that the SDK also has a built-in REST interface for the client to obtain data permission configuration and configure data permissions. When the user administrator configures the data permissions on the page, he requests access to the server, and the server uses regular fuzzy matching according to the request and enters the built-in interface to query the data permission list and dimension selection items. After the user administrator configures the data rules of the role based on the dimension selection items, the specific configuration results of the selection will be read through the selection item port, and the built-in save interface will be called to save the corresponding configuration results. Refer to Figure 7, which is an overall flow chart of data permission setting provided by the embodiment of the present invention. It can be seen from this figure that after the user logs in to the page to view the data permission settings, the SDK will call the service party to obtain the data permission configuration information, and the service party will obtain the data permission configuration information according to the parameters. Obtain the data permission configuration of the business party. The SDK encapsulates the selected item information based on the open port and displays the data permission list on the page. The user configures permissions based on the content displayed on the page (the process of configuring permissions includes the process of setting data rules for each role). The SDK encapsulates the configuration according to the open port, and the server saves the corresponding data permission configuration and returns the configuration result to the user for viewing; if the user wants to view specific functions, the SDK will call the server to obtain the SQL interface and the server assembles the data permission configuration of the function. The SDK automatically splices query SQL and displays the queried business data.

需要说明的是,在原方案的硬编码方式中,业务方需要针对数据进行权限控制一般流程经过:业务方需求评审→产品方案评审→技术方评审(交互评审)→代码实现→测试流程→发版,可见,业务方要进行数据权限控制,需要经历完整的开发周期流程,一般要经历1个月的开发周期。并且,在公司有多个业务方、多个应用需求时,各个业务应用都需要实现一套自己的数据权限功能,没有办法复用已有的能力,造成资源的浪费。而在本方案中,业务方需要针对数据进行权限控制一般流程经过:It should be noted that in the hard-coding method of the original solution, the business side needs to control permissions on the data. The general process goes through: business side requirements review → product plan review → technical side review (interactive review) → code implementation → testing process → release , it can be seen that if the business side wants to control data permissions, it needs to go through a complete development cycle process, which usually takes one month. Moreover, when a company has multiple business parties and multiple application requirements, each business application needs to implement its own set of data permission functions. There is no way to reuse existing capabilities, resulting in a waste of resources. In this solution, the business side needs to perform permission control on data. The general process goes through:

1、运营配置需要控制的功能数据权限;1. Functional data permissions that need to be controlled for operational configuration;

2、业务方接入SDK,自定义业务维度和端口实现,权限控制的功能接口查询使用SDK提供的API;2. The business party accesses the SDK, customizes business dimensions and port implementations, and uses the API provided by the SDK to query the functional interface for permission control;

3、管理员角色控制权限。3. Administrator role controls permissions.

可见,本方案的整个流程只有接入SDK的成本,1天内即可完成,快速、高效,极大的降低了成本。同时公司内所有系统都拥有一套完整统一的权限控制系统。具体来说,本方案将数据权限控制抽象成一个个数据规则,配置数据权限只需配置数据规则,主要有益效果包括:It can be seen that the entire process of this solution only costs the cost of accessing the SDK, and can be completed within one day. It is fast, efficient, and greatly reduces costs. At the same time, all systems in the company have a complete and unified authority control system. Specifically, this solution abstracts data permission control into data rules. To configure data permissions, you only need to configure data rules. The main beneficial effects include:

1、对数据权限的大部分模块都进行了通用的抽象,做到可快速复制、迁移、接入。1. Most modules of data permissions have been universally abstracted to enable rapid copying, migration, and access.

2、数据权限是有多维度的,常见的需要根据组织机构、角色、用户进行控制,当业务需要对包括以上且不止的角度进行数据控制的时候,对应本模型只需增加维度,对维度设置数据规则。2. Data permissions are multi-dimensional. Commonly, they need to be controlled according to the organization, role, and user. When the business needs to control data from the above and more perspectives, corresponding to this model, only need to add dimensions and set the dimensions. Data rules.

3、接入方便,业务方只需接入提供的SDK,对需要做权限控制的功能接口查询使用SDK提供的API,或者在XML查询方法打上自定义的标记。3. Access is convenient. Business parties only need to access the provided SDK, and use the API provided by the SDK to query functional interfaces that require permission control, or add custom tags to the XML query method.

下面对本发明实施例提供的数据权限设置装置、设备及存储介质进行介绍,下文描述的数据权限设置装置、设备及存储介质与上文描述的数据权限设置方法可以相互参照。The data permission setting device, equipment and storage medium provided by the embodiment of the present invention are introduced below. The data permission setting device, equipment and storage medium described below and the data permission setting method described above can be referred to each other.

参见图8,本发明实施例提供的一种数据权限设置装置结构示意图,包括:Referring to Figure 8, a schematic structural diagram of a data permission setting device provided by an embodiment of the present invention includes:

功能确定模块11,用于确定每个业务方的目标功能;Function determination module 11, used to determine the target function of each business party;

第一设置模块12,用于设置与每个目标功能对应的目标维度;The first setting module 12 is used to set the target dimensions corresponding to each target function;

第二设置模块13,用于设置与所述目标维度对应的目标条件规则及目标维度固定值,得到每个目标功能的数据规则;The second setting module 13 is used to set target condition rules and target dimension fixed values corresponding to the target dimensions, and obtain data rules for each target function;

第三设置模块14,用于为每个角色设置具有对应关系的目标数据规则,以便用户基于角色的目标数据规则访问对应的目标功能。The third setting module 14 is used to set target data rules with corresponding relationships for each role, so that users can access corresponding target functions based on the target data rules of the role.

在本发明另一实施例中,所述装置还包括:In another embodiment of the invention, the device further includes:

接收模块,用于接收业务方的管理员设置的自定义维度选择项,和/或自定义维度固定值选择项。The receiving module is used to receive the custom dimension selection items set by the administrator of the business party and/or the custom dimension fixed value selection items.

在本发明另一实施例中,所述第一设置模块具体用于:基于通用维度选择项和/或所述自定义维度选择项,设置每个目标功能的目标维度。In another embodiment of the present invention, the first setting module is specifically configured to set the target dimension of each target function based on the general dimension selection item and/or the custom dimension selection item.

在本发明另一实施例中,所述第二设置模块具体用于:基于通用维度固定值选择项和/或所述自定义维度固定值选择项,设置与所述目标维度对应的目标维度固定值。In another embodiment of the present invention, the second setting module is specifically configured to: based on the general dimension fixed value selection item and/or the custom dimension fixed value selection item, set the target dimension fixed value corresponding to the target dimension. value.

在本发明另一实施例中,所述装置还包括:In another embodiment of the invention, the device further includes:

获取模块,用于获取访问请求;所述访问请求为用户访问目标功能的请求;The acquisition module is used to obtain the access request; the access request is the user's request to access the target function;

判断模块,用于判断与所述访问请求对应的目标功能接口是否为权限接口;若是,则触发规则确定模块;A judgment module, used to judge whether the target function interface corresponding to the access request is a permission interface; if so, trigger the rule determination module;

规则确定模块,用于确定所述用户的所有角色的数据规则;A rule determination module, used to determine data rules for all roles of the user;

修改模块,用于根据所述数据规则对所述访问请求修改;A modification module, configured to modify the access request according to the data rules;

访问模块,用于基于修改后的访问请求访问对应的目标功能。The access module is used to access the corresponding target function based on the modified access request.

在本发明另一实施例中,所述规则确定模块具体用于:获取所述访问请求的上下文信息;根据所述上下文信息确定所述用户的所有角色的数据规则。In another embodiment of the present invention, the rule determination module is specifically configured to: obtain context information of the access request; and determine data rules for all roles of the user based on the context information.

在本发明另一实施例中,修改模块具体用于:若访问请求使用的是MyBatis的XML原生语句,则将数据规则封装成对应的SQL片段,并将SQL片段注入访问请求;若访问请求使用的是MyBatis-plus的QueryWrapper方式,则将数据规则注入访问请求的QueryWrapper条件中。In another embodiment of the present invention, the modification module is specifically used to: if the access request uses the XML native statement of MyBatis, encapsulate the data rules into corresponding SQL fragments, and inject the SQL fragment into the access request; if the access request uses The QueryWrapper method of MyBatis-plus injects data rules into the QueryWrapper conditions of the access request.

参见图9,本发明实施例提供的一种电子设备结构示意图,包括:Referring to Figure 9, a schematic structural diagram of an electronic device provided by an embodiment of the present invention includes:

存储器21,用于存储计算机程序;Memory 21, used to store computer programs;

处理器22,用于执行所述计算机程序时实现上述任意方法实施例所述的数据权限设置方法的步骤。The processor 22 is configured to implement the steps of the data permission setting method described in any of the above method embodiments when executing the computer program.

在本实施例中,设备可以是服务器,也可以是终端设备。In this embodiment, the device may be a server or a terminal device.

该设备可以包括存储器21、处理器22和总线23。The device may include a memory 21, a processor 22 and a bus 23.

其中,存储器21至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器21在一些实施例中可以是设备的内部存储单元,例如该设备的硬盘。存储器21在另一些实施例中也可以是设备的外部存储设备,例如设备上配备的插接式硬盘,智能存储卡(SmartMedia Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器21还可以既包括设备的内部存储单元也包括外部存储设备。存储器21不仅可以用于存储安装于设备的应用软件及各类数据,例如执行数据权限设置方法的程序代码等,还可以用于暂时地存储已经输出或者将要输出的数据。The memory 21 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 21 may in some embodiments be an internal storage unit of the device, such as a hard disk of the device. In other embodiments, the memory 21 may also be an external storage device of the device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (SD) card, a flash memory card ( Flash Card), etc. Further, the memory 21 may also include both an internal storage unit of the device and an external storage device. The memory 21 can not only be used to store application software installed on the device and various types of data, such as program codes for executing data permission setting methods, etc., but can also be used to temporarily store data that has been output or is to be output.

处理器22在一些实施例中可以是一中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,用于运行存储器21中存储的程序代码或处理数据,例如执行数据权限设置方法的程序代码等。In some embodiments, the processor 22 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor or other data processing chips for running program codes or processes stored in the memory 21 Data, such as program code that executes data permission setting methods, etc.

该总线23可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。为便于表示,图9中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 23 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into address bus, data bus, control bus, etc. For ease of presentation, only one thick line is used in Figure 9, but it does not mean that there is only one bus or one type of bus.

进一步地,设备还可以包括网络接口24,网络接口24可选的可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该设备与其他电子设备之间建立通信连接。Further, the device may also include a network interface 24. The network interface 24 may optionally include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which are usually used between the device and other electronic devices. Establish a communication connection.

可选地,该设备还可以包括用户接口25,用户接口25可以包括显示器(Display)、输入单元比如键盘(Keyboard),可选的用户接口25还可以包括标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在设备中处理的信息以及用于显示可视化的用户界面。Optionally, the device may also include a user interface 25. The user interface 25 may include a display (Display) and an input unit such as a keyboard (Keyboard). The optional user interface 25 may also include a standard wired interface and a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, or the like. The display may also be appropriately referred to as a display screen or a display unit, and is used for displaying information processed in the device and for displaying a visualized user interface.

图9仅示出了具有组件21-25的设备,本领域技术人员可以理解的是,图9示出的结构并不构成对设备的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。Figure 9 only shows the device with components 21-25. Persons skilled in the art can understand that the structure shown in Figure 9 does not constitute a limitation on the device, and may include fewer or more components than shown in the figure. Or combining certain parts, or different parts arrangements.

在本发明的另一实施例中,公开了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现上述任意方法实施例所述的数据权限设置方法的步骤。In another embodiment of the present invention, a computer-readable storage medium is disclosed. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, any of the above method embodiments are implemented. Steps for setting data permissions.

其中,该存储介质可以包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。Among them, the storage medium can include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc. that can store program codes. medium.

本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。Each embodiment in this specification is described in a progressive manner. Each embodiment focuses on its differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other.

对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments enables those skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be practiced in other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1.一种数据权限设置方法,其特征在于,包括:1. A data permission setting method, characterized by including: 确定每个业务方的目标功能;Determine the target functions of each business party; 设置与每个目标功能对应的目标维度;Set the target dimensions corresponding to each target function; 设置与所述目标维度对应的目标条件规则及目标维度固定值,得到每个目标功能的数据规则;Set the target condition rules and target dimension fixed values corresponding to the target dimensions to obtain the data rules for each target function; 为每个角色设置具有对应关系的目标数据规则,以便用户基于角色的目标数据规则访问对应的目标功能。Set target data rules with corresponding relationships for each role so that users can access the corresponding target functions based on the role's target data rules. 2.根据权利要求1所述的数据权限设置方法,其特征在于,所述确定每个业务方的目标功能之后,还包括:2. The data permission setting method according to claim 1, characterized in that after determining the target function of each business party, it further includes: 接收业务方的管理员设置的自定义维度选择项,和/或自定义维度固定值选择项。Receive custom dimension selections set by the business party's administrator, and/or custom dimension fixed value selections. 3.根据权利要求2所述的数据权限设置方法,其特征在于,所述设置与每个目标功能对应的目标维度,包括:3. The data permission setting method according to claim 2, characterized in that the setting of target dimensions corresponding to each target function includes: 基于通用维度选择项和/或所述自定义维度选择项,设置每个目标功能的目标维度。Set the target dimensions for each target feature based on the universal dimension selection and/or the custom dimension selection. 4.根据权利要求2所述的数据权限设置方法,其特征在于,设置与所述目标维度对应的目标维度固定值,包括:4. The data permission setting method according to claim 2, characterized in that setting a target dimension fixed value corresponding to the target dimension includes: 基于通用维度固定值选择项和/或所述自定义维度固定值选择项,设置与所述目标维度对应的目标维度固定值。Based on the general dimension fixed value selection item and/or the custom dimension fixed value selection item, a target dimension fixed value corresponding to the target dimension is set. 5.根据权利要求1至4中任意一项所述的数据权限设置方法,其特征在于,所述用户基于角色的目标数据规则访问对应的目标功能,包括:5. The data permission setting method according to any one of claims 1 to 4, characterized in that the user accesses the corresponding target function based on the target data rules of the role, including: 获取访问请求;所述访问请求为用户访问目标功能的请求;Obtain the access request; the access request is the user's request to access the target function; 判断与所述访问请求对应的目标功能接口是否为权限接口;Determine whether the target functional interface corresponding to the access request is a permission interface; 若是,则确定所述用户的所有角色的数据规则,并根据所述数据规则对所述访问请求修改后,基于修改后的访问请求访问对应的目标功能。If so, the data rules for all roles of the user are determined, and the access request is modified according to the data rules, and the corresponding target function is accessed based on the modified access request. 6.根据权利要求5所述的数据权限设置方法,其特征在于,所述确定所述用户的所有角色的数据规则,包括:6. The data permission setting method according to claim 5, characterized in that the data rules for determining all roles of the user include: 获取所述访问请求的上下文信息;Obtain context information of the access request; 根据所述上下文信息确定所述用户的所有角色的数据规则。Data rules for all roles of the user are determined based on the context information. 7.根据权利要求5所述的数据权限设置方法,其特征在于,所述根据所述数据规则对所述访问请求修改,包括:7. The data permission setting method according to claim 5, characterized in that the modification of the access request according to the data rules includes: 若所述访问请求使用的是MyBatis的XML原生语句,则将所述数据规则封装成对应的SQL片段,并将所述SQL片段注入所述访问请求;If the access request uses the XML native statement of MyBatis, encapsulate the data rules into corresponding SQL fragments, and inject the SQL fragments into the access request; 若所述访问请求使用的是MyBatis-plus的QueryWrapper方式,则将所述数据规则注入所述访问请求的QueryWrapper条件中。If the access request uses the QueryWrapper method of MyBatis-plus, the data rule is injected into the QueryWrapper condition of the access request. 8.一种数据权限设置装置,其特征在于,包括:8. A data permission setting device, characterized in that it includes: 功能确定模块,用于确定每个业务方的目标功能;Function determination module, used to determine the target functions of each business party; 第一设置模块,用于设置与每个目标功能对应的目标维度;The first setting module is used to set the target dimensions corresponding to each target function; 第二设置模块,用于设置与所述目标维度对应的目标条件规则及目标维度固定值,得到每个目标功能的数据规则;The second setting module is used to set the target condition rules and target dimension fixed values corresponding to the target dimensions, and obtain the data rules of each target function; 第三设置模块,用于为每个角色设置具有对应关系的目标数据规则,以便用户基于角色的目标数据规则访问对应的目标功能。The third setting module is used to set target data rules with corresponding relationships for each role, so that users can access corresponding target functions based on the target data rules of the role. 9.一种电子设备,其特征在于,包括:9. An electronic device, characterized in that it includes: 存储器,用于存储计算机程序;Memory, used to store computer programs; 处理器,用于执行所述计算机程序时实现如权利要求1至7任一项所述的数据权限设置方法的步骤。A processor, configured to implement the steps of the data permission setting method according to any one of claims 1 to 7 when executing the computer program. 10.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的数据权限设置方法的步骤。10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the data according to any one of claims 1 to 7 is realized. Steps for setting permissions.
CN202310648163.XA 2023-06-02 2023-06-02 Data authority setting method, device, equipment and storage medium Pending CN116776345A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310648163.XA CN116776345A (en) 2023-06-02 2023-06-02 Data authority setting method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310648163.XA CN116776345A (en) 2023-06-02 2023-06-02 Data authority setting method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116776345A true CN116776345A (en) 2023-09-19

Family

ID=87990565

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310648163.XA Pending CN116776345A (en) 2023-06-02 2023-06-02 Data authority setting method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116776345A (en)

Similar Documents

Publication Publication Date Title
US8832181B2 (en) Development and deployment of mobile and desktop applications within a flexible markup-based distributed architecture
US10387171B2 (en) Configurable development platform integrating heterogeneous persistence systems
CA2846162C (en) Methods and systems for open source integration
US11126618B1 (en) Computerized implementation framework to abstract data object definitions across multiple computing environments
US8712965B2 (en) Dynamic report mapping apparatus to physical data source when creating report definitions for information technology service management reporting for peruse of report definition transparency and reuse
CN108388622B (en) API interface dynamic generation method and device, computer equipment and storage medium
US20200065313A1 (en) Extensible content object metadata
US20140317594A1 (en) System and method for automatically forming human-machine interface
US20130325793A1 (en) Easy Query
US11468229B2 (en) Describing changes in a workflow based on changes in structured documents containing workflow metadata
CN110765187A (en) A data source routing management method and device
US9350738B2 (en) Template representation of security resources
US20080155518A1 (en) Methods and apparatus for tokenizing workflow process objects
US20150317572A1 (en) On-Demand Enrichment of Business Data
WO2010127552A1 (en) Service-oriented application system and communicating method, creator and creating method thereof
US9158932B2 (en) Modeled authorization check implemented with UI framework
CN112817564A (en) Mala back-end rapid development framework system and method
WO2012170565A2 (en) Code generation and implementation method, system, and storage medium for delivering bidirectional data aggregation and updates
CN116776345A (en) Data authority setting method, device, equipment and storage medium
CN112346774A (en) Method and device for generating application installation package
CN115357284A (en) Multi-dimensional data authority control configuration system and method
CN114579085A (en) API (application program interface) development method and device of gateway
CN114679366B (en) Tenant-oriented operation and maintenance tool opening method, system and medium in multi-cloud environment
CN116521686B (en) Dynamic data table processing method, device, computer equipment and storage medium
CN117311799B (en) Configuration method of software project page

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Country or region after: China

Address after: 5th Floor, Zone 2, Building 1, Science and Technology Economic Block 9, Zhuantang Street, Xihu District, Hangzhou City, Zhejiang Province 310024

Applicant after: Zhengcai Cloud Co.,Ltd.

Address before: 5 / F, area 2, building 1, No.9, Zhuantang science and technology economic block, Xihu District, Hangzhou City, Zhejiang Province, 310000

Applicant before: ZHENGCAIYUN Co.,Ltd.

Country or region before: China

CB02 Change of applicant information