CN118036023A - RBAC-based authority control method, and method and device for establishing model - Google Patents
RBAC-based authority control method, and method and device for establishing model Download PDFInfo
- Publication number
- CN118036023A CN118036023A CN202211421260.7A CN202211421260A CN118036023A CN 118036023 A CN118036023 A CN 118036023A CN 202211421260 A CN202211421260 A CN 202211421260A CN 118036023 A CN118036023 A CN 118036023A
- Authority
- CN
- China
- Prior art keywords
- permission
- space
- data
- authority
- variable
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/604—Tools and structures for managing or administering access control systems
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2221/00—Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/21—Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/2141—Access rights, e.g. capability lists, access control lists, access tables, access matrices
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Health & Medical Sciences (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Automation & Control Theory (AREA)
- Storage Device Security (AREA)
Abstract
本发明公开了一种基于RBAC的权限控制方法、模型的建立方法及装置,方法包括:接收请求信号并确认所述请求信号对应的权限空间以及权限空间序号;所述请求信号为用户请求权限操作时所产生的信号;判断所述用户对应的角色中是否包含所述权限空间;若是,则获取所述权限空间对应的权限变量;根据所述权限空间序号获取权限变量值;判断所述权限变量值与所述角色的预设权限变量值是否相同;若是,则生成权限信号。本发明上述实施例所述的权限控制方法能够解决权限的精确性和细粒度问题,实现权限的精准控制。
The present invention discloses a permission control method based on RBAC, a method for establishing a model and a device, the method comprising: receiving a request signal and confirming the permission space and permission space serial number corresponding to the request signal; the request signal is a signal generated when a user requests a permission operation; judging whether the role corresponding to the user contains the permission space; if so, obtaining the permission variable corresponding to the permission space; obtaining the permission variable value according to the permission space serial number; judging whether the permission variable value is the same as the preset permission variable value of the role; if so, generating a permission signal. The permission control method described in the above embodiment of the present invention can solve the accuracy and fine-grainedness problems of permissions and realize precise control of permissions.
Description
技术领域Technical Field
本发明涉及计算机软件领域,特别是关于一种基于RBAC的权限控制方法、模型的建立方法及装置。The present invention relates to the field of computer software, and in particular to a permission control method based on RBAC, a model establishment method and a device.
背景技术Background technique
RBAC是基于角色的访问控制(Role-Based Access Control),在RBAC中权限与角色相关联,用户通过成为适当角色的成员而得到这些角色的权限,这极大地简化了权限的管理。因为基于RBAC的管理层级间是相互依赖的,将权限赋予给角色,再将角色赋予用户,这样的权限设计清楚且方便管理。RBAC is role-based access control. In RBAC, permissions are associated with roles. Users obtain permissions of these roles by becoming members of appropriate roles, which greatly simplifies the management of permissions. Because the management levels based on RBAC are interdependent, permissions are granted to roles, and then roles are granted to users. This permission design is clear and easy to manage.
RBAC模型是一个宽泛的主体模型,它规定了用户、角色、权限之间的关系,在此基础上扩展了RBAC1、RBAC2和RBAC3。RBAC1、RBAC2和RBAC3的本质上都是对角色的扩展,如角色的继承、角色的约束等。对于权限的具体实现并无细节规定,目前行业上权限的常规实现方案是对软件系统的菜单、按钮和数据权限三个维度进行权限控制,其中菜单、按钮是通过符合RBAC的角色管控进行控制,数据权限只能通过非RBAC组织级别实现,其它方案单独实现数据权限;或符合RBAC模型的权限通过角色实现,即RBAC模型仅实现简单的数据权限控制。但这种权限控制方法对功能权限、数据权限控制的精确性和细粒度都显不足。The RBAC model is a broad subject model that specifies the relationship between users, roles, and permissions, and on this basis, RBAC1, RBAC2, and RBAC3 are extended. RBAC1, RBAC2, and RBAC3 are essentially extensions of roles, such as role inheritance, role constraints, etc. There are no detailed regulations on the specific implementation of permissions. At present, the conventional implementation scheme of permissions in the industry is to control permissions in three dimensions: menus, buttons, and data permissions of software systems. Menus and buttons are controlled through role management that conforms to RBAC, and data permissions can only be implemented through non-RBAC organizational levels. Other schemes implement data permissions separately; or permissions that conform to the RBAC model are implemented through roles, that is, the RBAC model only implements simple data permission control. However, this permission control method is insufficient in terms of the accuracy and granularity of functional permissions and data permission control.
信息化、数字化、智能化是当今社会的发展趋势,随着数据及网络的普及,数据安全、网络安全等安全性越来越被重视,用户能获取的数据或网络就要求更精准、更及时。用户权限控制是保障安全的一个重要手段,用户权限的精确性、时效性和高效性就更显重要,需要提出一种全新的权限控制方法以解决上述问题。Informatization, digitization, and intelligence are the development trends of today's society. With the popularization of data and networks, data security, network security, and other security issues are becoming more and more important. The data or network that users can obtain requires to be more accurate and timely. User permission control is an important means to ensure security. The accuracy, timeliness, and efficiency of user permissions are even more important. A new permission control method needs to be proposed to solve the above problems.
发明内容Summary of the invention
本发明的目的在于提供一种基于RBAC的权限控制方法、模型的建立方法及装置,解决现有技术中传统的RBAC模型对功能权限、数据权限控制的精确性和细粒度都不足的问题。The purpose of the present invention is to provide a permission control method based on RBAC, a method for establishing a model and a device, so as to solve the problem that the traditional RBAC model in the prior art is insufficient in accuracy and granularity in controlling functional permissions and data permissions.
为实现上述目的,本发明提供了一种基于RBAC的权限控制方法,所述方法包括:To achieve the above object, the present invention provides a permission control method based on RBAC, the method comprising:
接收请求信号并确认所述请求信号对应的权限空间以及权限空间序号;所述请求信号为用户请求权限操作时所产生的信号,所述权限空间为权限控制点;Receive a request signal and confirm the permission space and permission space serial number corresponding to the request signal; the request signal is a signal generated when a user requests a permission operation, and the permission space is a permission control point;
判断所述用户对应的角色中是否包含所述权限空间;Determine whether the role corresponding to the user contains the permission space;
若是,则获取所述权限空间对应的权限变量;所述权限变量表征所述权限操作的属性;If yes, then obtain the permission variable corresponding to the permission space; the permission variable represents the attribute of the permission operation;
根据所述权限空间序号获取权限变量值;Obtaining the permission variable value according to the permission space sequence number;
判断所述权限变量值与所述角色的预设权限变量值是否相同;Determine whether the permission variable value is the same as the preset permission variable value of the role;
若是,则生成权限信号。If so, a permission signal is generated.
可选的,所述权限操作包括:功能权限和/或数据权限;所述生成权限信号包括:Optionally, the permission operation includes: function permission and/or data permission; and generating a permission signal includes:
根据所述功能权限生成操作信号以令所述用户进行所述权限操作,和/或,获取与所述数据权限对应的数据后返回所述用户。Generate an operation signal according to the functional authority to enable the user to perform the authority operation, and/or obtain data corresponding to the data authority and return it to the user.
可选的,所述获取与所述数据权限对应的数据后返回所述用户,包括:Optionally, the acquiring the data corresponding to the data permission and returning it to the user includes:
获取第一数据,所述第一数据为同一权限空间序号下所述权限变量对应的可获取数据的交集;Acquire first data, where the first data is an intersection of obtainable data corresponding to the permission variables under the same permission space sequence number;
对于所述数据权限对应的任一权限空间,对所述数据权限对应的各权限空间序号所控制的第一数据取并集,得到第二数据;For any permission space corresponding to the data permission, take a union of the first data controlled by the sequence numbers of the permission spaces corresponding to the data permission to obtain the second data;
对所述数据权限对应的各权限空间所控制的第二数据取并集,得到第三数据;Taking a union of the second data controlled by each permission space corresponding to the data permission to obtain third data;
将所述第三数据返回所述用户。The third data is returned to the user.
可选的,所述方法还包括:Optionally, the method further includes:
确定所述请求信号对应的资源;所述资源表征需要进行权限控制的事件;Determining a resource corresponding to the request signal; the resource represents an event requiring permission control;
基于所述资源获取与所述资源对应的权限空间。A permission space corresponding to the resource is acquired based on the resource.
可选的,所述方法还包括:Optionally, the method further includes:
获取时效对象;所述时效对象用于定义对象的有效性;所述对象包括:用户、角色、资源、权限空间、权限变量、用户与角色的对应关系、角色与资源的对应关系、资源与权限空间的对应关系、角色与权限空间的对应关系以及权限空间与权限变量的对应关系;Obtaining a timeliness object; the timeliness object is used to define the validity of an object; the object includes: users, roles, resources, permission spaces, permission variables, the correspondence between users and roles, the correspondence between roles and resources, the correspondence between resources and permission spaces, the correspondence between roles and permission spaces, and the correspondence between permission spaces and permission variables;
根据所述时效对象计算有效的所述对象。The object that is valid is calculated based on the time-effective object.
可选的,所述方法还包括:当用户对应的角色中不包含所述权限空间或当所述权限变量值与所述预设权限变量值不相同时,生成无权限结果。Optionally, the method further includes: generating a no-authority result when the role corresponding to the user does not include the permission space or when the permission variable value is different from the preset permission variable value.
本发明提供一种基于RBAC的权限控制装置,所述装置包括:The present invention provides a permission control device based on RBAC, the device comprising:
接收单元,用于接收请求信号并确认所述请求信号对应的权限空间以及权限空间序号;所述请求信号为用户请求权限操作时所产生的信号,所述权限空间为权限控制点;A receiving unit, configured to receive a request signal and confirm the permission space and permission space sequence number corresponding to the request signal; the request signal is a signal generated when a user requests a permission operation, and the permission space is a permission control point;
第一判断单元,用于判断所述用户对应的角色中是否包含所述权限空间;A first judging unit, configured to judge whether the role corresponding to the user includes the permission space;
第一获取单元,用于若是,则获取所述权限空间对应的权限变量;所述权限变量表征所述权限操作的属性;A first acquisition unit is configured to acquire, if yes, a permission variable corresponding to the permission space; the permission variable represents an attribute of the permission operation;
第二获取单元,用于根据所述权限空间序号获取权限变量值;A second acquisition unit, used to acquire the permission variable value according to the permission space sequence number;
第二判断单元,用于判断所述权限变量值与所述角色的预设权限变量值是否相同;A second judgment unit, used to judge whether the authority variable value is the same as the preset authority variable value of the role;
生成单元,用于若是,则生成权限信号。A generating unit is used for generating a permission signal if yes.
本发明提供一种基于RBAC的权限控制模型的建立方法,所述方法包括:The present invention provides a method for establishing a permission control model based on RBAC, the method comprising:
建立权限空间;所述权限空间为权限控制点;Establishing an authority space; the authority space is an authority control point;
建立角色,并建立用户与角色的关联关系以及所述角色与所述权限空间的关联关系;Establishing roles, and establishing associations between users and roles, and between the roles and the permission space;
建立权限变量,并建立所述权限空间与权限变量的关联关系;Establishing an authority variable, and establishing an association relationship between the authority space and the authority variable;
设置所述权限变量对应的一个或多个权限变量值;Set one or more permission variable values corresponding to the permission variable;
建立所述权限变量值与所述权限空间序号的对应关系。A corresponding relationship between the permission variable value and the permission space sequence number is established.
可选的,所述方法还包括:建立与所述权限空间对应的资源;所述资源表征需要进行权限控制的事件。Optionally, the method further includes: establishing resources corresponding to the permission space; the resources represent events that require permission control.
可选的,所述方法包括:Optionally, the method comprises:
建立时效对象;Establishing time-limited objects;
建立时效对象与对象之间的关联关系;所述时效对象用于定义所述对象的有效性;所述对象包括:用户、角色、资源、权限空间、权限变量、用户与角色的对应关系、角色与资源的对应关系、资源与权限空间的对应关系、角色与权限空间的对应关系以及权限空间与权限变量的对应关系。Establish associations between time-limited objects and objects; the time-limited objects are used to define the validity of the objects; the objects include: users, roles, resources, permission spaces, permission variables, the correspondence between users and roles, the correspondence between roles and resources, the correspondence between resources and permission spaces, the correspondence between roles and permission spaces, and the correspondence between permission spaces and permission variables.
本发明还提供一种基于RBAC的权限控制模型的建立装置,所述装置包括:The present invention also provides a device for establishing a permission control model based on RBAC, the device comprising:
第一建立单元,用于建立权限空间;所述权限空间为权限控制点;A first establishing unit is used to establish an authority space; the authority space is an authority control point;
第二建立单元,用于建立角色,并建立用户与角色的关联关系以及所述角色与所述权限空间的关联关系;A second establishing unit, used to establish a role, and establish an association relationship between a user and a role, and an association relationship between the role and the permission space;
第三建立单元,用于建立权限变量,并建立所述权限空间与权限变量的关联关系;A third establishing unit, used to establish an authority variable, and establish an association relationship between the authority space and the authority variable;
设置单元,用于设置所述权限变量对应的一个或多个权限变量值;A setting unit, used to set one or more permission variable values corresponding to the permission variable;
第四建立单元,用于建立所述权限变量值与所述权限空间序号的对应关系。The fourth establishing unit is used to establish a corresponding relationship between the permission variable value and the permission space sequence number.
本发明还提供一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如上任一项所述的基于RBAC的权限控制方法的步骤,和/或任一项所述的基于RBAC的权限控制模型的建立方法。The present invention also provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the RBAC-based permission control method described in any one of the above items and/or the method for establishing the RBAC-based permission control model described in any one of the above items are implemented.
本发明还提供一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现上述任意一种基于RBAC的权限控制方法的步骤,和/或任一项所述的基于RBAC的权限控制模型的建立方法。The present invention also provides a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any of the above-mentioned RBAC-based permission control methods and/or any of the methods for establishing an RBAC-based permission control model.
本发明提供一种基于RBAC的权限控制方法、模型的建立方法及装置,通过将权限空间定义为权限控制点,在权限控制点下再包含权限变量并通过权限空间序号确定权限变量值,以此提高权限控制中的精确性和细粒度问题。The present invention provides a permission control method based on RBAC, a method for establishing a model and a device, which improves the accuracy and fine-grainedness of permission control by defining a permission space as a permission control point, including permission variables under the permission control point and determining the permission variable value through the permission space sequence number.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是根据本发明一实施方式的一种基于RBAC的权限控制方法流程图;FIG1 is a flow chart of a permission control method based on RBAC according to an embodiment of the present invention;
图2是根据本发明一实施方式的一种基于RBAC的权限控制方法流程图;FIG2 is a flow chart of a permission control method based on RBAC according to an embodiment of the present invention;
图3是根据本发明一实施方式的对象与时效对象的关系模型图;3 is a diagram of a relationship model between an object and a time-effect object according to an embodiment of the present invention;
图4是根据本发明一实施方式的一种基于RBAC的权限控制装置结构图;FIG4 is a structural diagram of a permission control device based on RBAC according to an embodiment of the present invention;
图5是根据本发明一实施方式的一种基于RBAC的权限控制模型的建立方法流程图;5 is a flow chart of a method for establishing a permission control model based on RBAC according to an embodiment of the present invention;
图6是根据本发明一实施方式的一种基于RBAC的权限控制模型的建立装置结构图;6 is a structural diagram of a device for establishing a permission control model based on RBAC according to an embodiment of the present invention;
图7是根据本发明一实施方式的一种基于RBAC的权限控制模型结构图;7 is a structural diagram of a permission control model based on RBAC according to an embodiment of the present invention;
图8是根据本发明一实施方式的一种计算机设备结构图。FIG. 8 is a structural diagram of a computer device according to an embodiment of the present invention.
具体实施方式Detailed ways
下面结合附图,对本发明的具体实施方式进行详细描述,但应当理解本发明的保护范围并不受具体实施方式的限制。The specific implementation modes of the present invention are described in detail below in conjunction with the accompanying drawings, but it should be understood that the protection scope of the present invention is not limited by the specific implementation modes.
除非另有其它明确表示,否则在整个说明书和权利要求书中,术语“包括”或其变换如“包含”或“包括有”等等将被理解为包括所陈述的元件或组成部分,而并未排除其它元件或其它组成部分。Unless explicitly stated otherwise, throughout the specification and claims, the term “comprise” or variations such as “include” or “comprising”, etc., will be understood to include the stated elements or components but not to exclude other elements or components.
根据本发明可选实施方式的一种基于RBAC的权限控制方法,如图1所示,所述方法包括:According to an optional implementation of the present invention, a permission control method based on RBAC is shown in FIG1 , and the method includes:
步骤101,接收请求信号并确认所述请求信号对应的权限空间以及权限空间序号;所述请求信号为用户请求权限操作时所产生的信号,所述权限空间为权限控制点。具体的,当用户需要对某一功能进行操作时,首先向服务器端发送请求信号以请求获取权限,获取的权限可以用于操作该功能。当服务器端接收到用户端发送的请求信号后,需要根据该请求信号确认该用户是否具有相应的操作权限,在此需要根据请求信号确认请求信号对应的权限空间。在本发明具体实施例中,权限空间为权限控制点,表示最小粒度的某一个权限,代表控制一个具体权限的细粒度最小划分至权限空间。把用户的权限划分成若干个权限空间以通过权限空间定义用户的多个权限,提供了权限控制的细粒度,使得在授予权限时更加精准。Step 101, receiving a request signal and confirming the permission space and permission space serial number corresponding to the request signal; the request signal is a signal generated when a user requests a permission operation, and the permission space is a permission control point. Specifically, when a user needs to operate a certain function, he first sends a request signal to the server to request permission, and the obtained permission can be used to operate the function. After the server receives the request signal sent by the user, it is necessary to confirm whether the user has the corresponding operation permission according to the request signal. Here, it is necessary to confirm the permission space corresponding to the request signal according to the request signal. In a specific embodiment of the present invention, the permission space is a permission control point, which represents a certain permission of the smallest granularity, and represents the fine-grained minimum division of the control of a specific permission into the permission space. Dividing the user's permissions into several permission spaces to define multiple permissions of the user through the permission space provides fine-grained permission control, making it more accurate when granting permissions.
步骤102,判断所述用户对应的角色中是否包含所述权限空间。具体的,根据用户端发送的请求信号可以识别该用户以及该用户对应的角色。用户与角色可以一一对应或者多对多,即同一个用户在不同情形下可能具有不同的角色,而不同的角色又与不同的权限空间具有映射关系,而角色与权限空间也可以一一对应或者多对多,即一个角色具有不同的权限空间,一个权限空间也可以对应多个角色。这样同一个用户在不同角色下所对应的权限空间可能不同,如果需要确认用户是否具有该权限空间对应的权限,需要判断该用户对应多个角色中是否包含步骤100中确认的权限空间,以确定用户在该情景下所对应的角色和权限空间是否具有对应关系。Step 102, determine whether the role corresponding to the user contains the permission space. Specifically, the user and the role corresponding to the user can be identified according to the request signal sent by the user end. Users and roles can correspond one-to-one or many-to-many, that is, the same user may have different roles in different situations, and different roles have a mapping relationship with different permission spaces, and roles and permission spaces can also correspond one-to-one or many-to-many, that is, a role has different permission spaces, and a permission space can also correspond to multiple roles. In this way, the permission spaces corresponding to the same user under different roles may be different. If it is necessary to confirm whether the user has the authority corresponding to the permission space, it is necessary to determine whether the permission space confirmed in step 100 is included in the multiple roles corresponding to the user, so as to determine whether the role corresponding to the user in this scenario and the permission space have a corresponding relationship.
步骤103,若是,则获取所述权限空间对应的权限变量;所述权限变量表征所述权限操作的属性。具体的,权限变量是权限控制属性,具体可以是功能的权限控制属性或数据权限控制属性。在权限空间这个最小粒度的权限控制点下还包含权限变量这个灵活的权限控制属性,以此来进一步解决权限的精确性和细粒度问题。具体的,权限空间通常将一个或多个权限变量组合在一起控制具体的操作权限。其中,权限空间与权限变量可以是一对一的关系、一对多或者多对多的关系,具体根据需要进行应用。Step 103, if yes, then obtain the permission variable corresponding to the permission space; the permission variable represents the attribute of the permission operation. Specifically, the permission variable is a permission control attribute, which can be a function permission control attribute or a data permission control attribute. The permission space, which is the permission control point with the smallest granularity, also includes the permission variable, a flexible permission control attribute, to further solve the accuracy and granularity problems of permissions. Specifically, the permission space usually combines one or more permission variables to control specific operation permissions. Among them, the permission space and the permission variable can be a one-to-one relationship, a one-to-many relationship, or a many-to-many relationship, which is applied according to specific needs.
步骤104,根据所述权限空间序号获取权限变量值。具体的,所述权限变量可以包含一个或多个权限变量值,权限变量值可以在初始设置时通过对权限变量值的赋值范围进行限制另其满足用户需求并明确角色的具体作用。权限空间序号与权限变量值对应,通过权限空间能够确定其对应的权限空间序号,再通过权限空间序号确定权限空间对应的权限变量的具体赋值,即权限变量值。例如,当权限空间A对应2个权限空间序号1和2,且该权限空间A对应3个权限变量X,Y,Z,那么权限变量X,Y,Z的权限变量值分别可通过权限空间序号1和/或2确定。Step 104, obtain the permission variable value according to the permission space serial number. Specifically, the permission variable may include one or more permission variable values, and the permission variable value may satisfy user needs and clarify the specific role of the role by limiting the assignment range of the permission variable value during the initial setting. The permission space serial number corresponds to the permission variable value, and the permission space can determine its corresponding permission space serial number, and then determine the specific assignment of the permission variable corresponding to the permission space, that is, the permission variable value, through the permission space serial number. For example, when permission space A corresponds to two permission space serial numbers 1 and 2, and the permission space A corresponds to three permission variables X, Y, and Z, then the permission variable values of permission variables X, Y, and Z can be determined by permission space serial numbers 1 and/or 2, respectively.
步骤105,判断所述权限变量值与所述角色的预设权限变量值是否相同。具体的,当获取了所述权限变量值后,仍需要判断一个或多个权限变量的变量值与所述用户的预设权限变量值是否相同以进一步确定用户的具体权限,即通过自上而下多层权限的筛选,实现权限的精准控制。本发明实施例中不同的权限变量值再一次细分了权限,以便权限操作更加细分化和具体化,便于应用于不同的场景或系统中。Step 105, determine whether the permission variable value is the same as the preset permission variable value of the role. Specifically, after obtaining the permission variable value, it is still necessary to determine whether the variable value of one or more permission variables is the same as the preset permission variable value of the user to further determine the specific permissions of the user, that is, through the top-down multi-layer permission screening, accurate control of permissions is achieved. In the embodiment of the present invention, different permission variable values once again subdivide permissions, so that permission operations are more subdivided and specific, which is convenient for application in different scenarios or systems.
步骤106,若是,则生成权限信号。Step 106: If yes, generate an authorization signal.
当步骤105中判断所述权限变量值与所述角色的预设权限变量值相同时,意味着该用户所具有该权限,因此通过生成权限信号向用户进行权限授权。When it is determined in step 105 that the authority variable value is the same as the preset authority variable value of the role, it means that the user has the authority, and therefore the authority is authorized to the user by generating an authority signal.
本发明上述实施例针对用户的角色进行权限判断,以确认用户的权限范围,同时将权限空间定义为权限控制点,并通过用户、角色以及权限空间的相互关联关系对权限范围进行判断,以此来解决权限的精确性和细粒度问题,实现权限的精准控制。The above-mentioned embodiment of the present invention performs permission judgment based on the user's role to confirm the user's permission scope, and at the same time defines the permission space as a permission control point, and judges the permission scope through the mutual relationship between the user, role and permission space, so as to solve the accuracy and granularity problems of permissions and realize precise control of permissions.
本发明另一可选的具体实施例所述的一种基于RBAC的权限控制方法中,所述权限操作包括:功能权限和/或数据权限;所述生成权限信号包括:根据所述功能权限生成操作信号以令所述用户进行所述权限操作和/或获取与所述数据权限对应的数据后返回所述用户。具体的实施例中,当所述权限变量对应的权限变量值与所述用户的预设权限变量值相同时,可以进一步根据该用户端发出的请求信号中所请求的权限操作为功能权限还是数据权限的不同而提供不同的信号或数据。例如,当权限操作为功能权限时,最终会向用户提供相应的操作功能,即用户可以对某权限的操作;如果权限操作为数据权限时,即用户端请求的权限操作为获取某个或某类数据,会根据权限变量获取对应的数据并将对应的数据提供至用户端以供用户查看。本发明实施例明确地细化了用户的功能权限与数据权限、提高了系统的安全性、时效性和高效性。In a permission control method based on RBAC described in another optional specific embodiment of the present invention, the permission operation includes: functional permission and/or data permission; the generating permission signal includes: generating an operation signal according to the functional permission to make the user perform the permission operation and/or obtain the data corresponding to the data permission and then return it to the user. In a specific embodiment, when the permission variable value corresponding to the permission variable is the same as the preset permission variable value of the user, different signals or data can be provided according to whether the permission operation requested in the request signal sent by the user end is a functional permission or a data permission. For example, when the permission operation is a functional permission, the corresponding operation function will eventually be provided to the user, that is, the user can operate on a certain permission; if the permission operation is a data permission, that is, the permission operation requested by the user end is to obtain a certain or a certain type of data, the corresponding data will be obtained according to the permission variable and the corresponding data will be provided to the user end for the user to view. The embodiment of the present invention clearly refines the user's functional permissions and data permissions, and improves the security, timeliness and efficiency of the system.
本发明具体实施例所述的一种基于RBAC的权限控制方法,可选的,如图2所示,所述获取与所述数据权限对应的数据后返回所述用户包括:In a method for controlling permissions based on RBAC according to a specific embodiment of the present invention, optionally, as shown in FIG2 , the step of returning the data corresponding to the data permission to the user after obtaining the data includes:
步骤107,获取第一数据,所述第一数据为同一权限空间序号下所述权限变量对应的可获取数据的交集。具体的,请求数据权限操作时,由于权限控制点为权限空间,当权限空间下仅包含一个权限空间序号时,该权限空间序号下所有权限变量对应的可获取数据之间具有互斥性,即相同的可获取数据为对应该权限空间序号的第一数据,每个权限变量下不同的数据不是该权限空间序号的第一数据,因此需要将同一权限空间序号中的多个权限变量对应的可获取数据取交集以获得该权限空间序号下的第一数据。Step 107, obtain the first data, which is the intersection of the obtainable data corresponding to the permission variable under the same permission space sequence number. Specifically, when requesting a data permission operation, since the permission control point is the permission space, when the permission space contains only one permission space sequence number, the obtainable data corresponding to all permission variables under the permission space sequence number are mutually exclusive, that is, the same obtainable data is the first data corresponding to the permission space sequence number, and the different data under each permission variable is not the first data of the permission space sequence number. Therefore, it is necessary to take the intersection of the obtainable data corresponding to multiple permission variables in the same permission space sequence number to obtain the first data under the permission space sequence number.
步骤108,对于所述数据权限对应的任一权限空间,对所述数据权限对应的各权限空间序号所控制的第一数据取并集,得到第二数据。当具有多个权限空间序号时,用户所需的数据为每个权限空间序号所对应的第一数据之和。即单个权限空间序号下所对应的第一数据的并集作为第二数据;Step 108: For any permission space corresponding to the data permission, take the union of the first data controlled by each permission space number corresponding to the data permission to obtain the second data. When there are multiple permission space numbers, the data required by the user is the sum of the first data corresponding to each permission space number. That is, the union of the first data corresponding to a single permission space number is used as the second data;
步骤109,对所述数据权限对应的各权限空间所控制的第二数据取并集,得到第三数据。具体的,当一个权限空间对应多个权限空间序号,即所需获取的数据权限为多个第二数据时,通过步骤109获取所需全部第二数据的并集以获得第三数据,第三数据就是该用户所需的全部数据。Step 109, taking the union of the second data controlled by each permission space corresponding to the data permission to obtain the third data. Specifically, when one permission space corresponds to multiple permission space numbers, that is, the data permission to be obtained is multiple second data, the union of all the required second data is obtained through step 109 to obtain the third data, and the third data is all the data required by the user.
步骤110,将所述第三数据返回所述用户。至此用户可以获取数据权限所对应的数据。Step 110: Return the third data to the user. Now the user can obtain the data corresponding to the data permission.
本发明具体实施例所述的一种基于RBAC的权限控制方法,可选的,获取所述用户信息对应的角色后,所述方法还包括:The RBAC-based permission control method described in the specific embodiment of the present invention, optionally, after obtaining the role corresponding to the user information, the method further includes:
确认所述请求信号对应的资源;所述资源表征需要进行权限控制的事件。具体的,资源可以是任何需要控制权限的事件,例如信息系统的菜单、网关上的端口号、视屏网站的视频等。以ERP系统为例,资源可以指系统的菜单、接口、报表等,菜单可以是“物资采购管理”、“物资库存管理”等菜单,接口可以是“物资查询”,“物资添加”、“物资修改”等接口,因此基于所述资源获取与所述资源对应的权限空间。本实施例不同于上述实施例,权限空间与角色之间通过资源连通,即角色与资源、资源与权限空间分别具有关联关系,例如角色与资源具有关联关系,资源与权限空间具有关联关系,以便通过不同的资源增加权限控制的精细度。Confirm the resource corresponding to the request signal; the resource represents an event that requires permission control. Specifically, the resource can be any event that requires permission control, such as a menu of an information system, a port number on a gateway, a video on a video website, etc. Taking the ERP system as an example, resources can refer to menus, interfaces, reports, etc. of the system. Menus can be menus such as "Material Procurement Management" and "Material Inventory Management", and interfaces can be interfaces such as "Material Query", "Material Addition", and "Material Modification", so that the permission space corresponding to the resource is obtained based on the resource. This embodiment is different from the above embodiment. The permission space and the role are connected through resources, that is, the role and the resource, the resource and the permission space have an association relationship respectively, for example, the role and the resource have an association relationship, and the resource and the permission space have an association relationship, so as to increase the sophistication of permission control through different resources.
基于所述资源获取与所述资源对应的权限空间。本发明具体实施例中,通过角色对应的资源再查找资源对应的权限空间,最终获得与角色对应的权限空间。例如,资源为物资采购管理菜单,其对应创建物料采购管理权限空间s_materil以及创建物资库存管理权限空间s_stock,即物资采购管理菜单资源对应权限空间s_materil和s_stock。Based on the resource, the permission space corresponding to the resource is obtained. In a specific embodiment of the present invention, the permission space corresponding to the resource is searched through the resource corresponding to the role, and finally the permission space corresponding to the role is obtained. For example, the resource is a material procurement management menu, which corresponds to the creation of a material procurement management permission space s_materil and the creation of a material inventory management permission space s_stock, that is, the material procurement management menu resource corresponds to the permission spaces s_materil and s_stock.
本发明具体实施例所述的一种基于RBAC的权限控制方法,可选的,所述方法还包括:The RBAC-based permission control method described in the specific embodiment of the present invention, optionally, the method further includes:
获取时效对象;所述时效对象用于定义对象的有效性;所述对象包括:用户、角色、资源、权限空间、权限变量、用户与角色的对应关系、角色与资源的对应关系、资源与权限空间的对应关系、角色与权限空间的对应关系以及权限空间与权限变量的对应关系;Obtaining a timeliness object; the timeliness object is used to define the validity of an object; the object includes: users, roles, resources, permission spaces, permission variables, the correspondence between users and roles, the correspondence between roles and resources, the correspondence between resources and permission spaces, the correspondence between roles and permission spaces, and the correspondence between permission spaces and permission variables;
根据所述时效对象计算有效的所述对象。The object that is valid is calculated based on the time-effective object.
具体的实施例中,时效对象是对其所属的对象有效性的定义,可以是一段时间、几个条件或特定环境等。在本发明具体实施例中,如图3所示,时效对象可以作用于模型中的所有对象或者部分对象,对象既包括用户、角色、资源、权限空间以及权限变量,还包括用户与角色的对应关系、角色与资源的对应关系、资源与权限空间的对应关系、角色与权限空间的对应关系以及权限空间与权限变量的对应关系。通过以上具体的实施例,系统管理员或运营人员可以随时对对象的时效性进行创建和修改,在达到时效要求时,权限自动生效或失效,不必按时手动操作,这样大大提高了系统的安全性和高效性。In a specific embodiment, a timeliness object is a definition of the validity of the object to which it belongs, which can be a period of time, several conditions or a specific environment, etc. In a specific embodiment of the present invention, as shown in FIG3 , a timeliness object can act on all objects or part of the objects in the model, and the objects include users, roles, resources, permission spaces and permission variables, as well as the correspondence between users and roles, the correspondence between roles and resources, the correspondence between resources and permission spaces, the correspondence between roles and permission spaces, and the correspondence between permission spaces and permission variables. Through the above specific embodiments, system administrators or operators can create and modify the timeliness of objects at any time. When the timeliness requirements are met, the permissions automatically take effect or become invalid, and there is no need to manually operate on time, which greatly improves the security and efficiency of the system.
本发明具体实施例所述的一种基于RBAC的权限控制方法,可选的,所述方法还包括:当用户对应的角色中不包含所述权限空间或当所述权限变量的变量值与用户的预设权限变量值不相同时,生成无权限结果。其中,无权权限结果是指用户不具有所请求的权限,也即无权获取权限。例如,角色不包含所述权限空间或者权限变量的权限变量值与用户的预设权限变量值不相同都属于无权获取权限的情况。A method for controlling permissions based on RBAC described in a specific embodiment of the present invention, optionally, the method further includes: generating a no-authority result when the role corresponding to the user does not contain the permission space or when the variable value of the permission variable is different from the preset permission variable value of the user. The no-authority result means that the user does not have the requested permission, that is, has no right to obtain permission. For example, the role does not contain the permission space or the permission variable value of the permission variable is different from the preset permission variable value of the user, both of which are situations where there is no right to obtain permission.
本发明具体实施例提供一种基于RBAC的权限控制装置,如图4所示,所述装置包括:A specific embodiment of the present invention provides a permission control device based on RBAC, as shown in FIG4 , the device includes:
接收单元401,用于接收请求信号并确认所述请求信号对应的权限空间以及权限空间序号;所述请求信号为用户请求权限操作时所产生的信号,所述权限空间为权限控制点;The receiving unit 401 is used to receive a request signal and confirm the permission space and permission space sequence number corresponding to the request signal; the request signal is a signal generated when a user requests a permission operation, and the permission space is a permission control point;
第一判断单元402,用于判断所述用户对应的角色中是否包含所述权限空间;A first judging unit 402 is used to judge whether the role corresponding to the user includes the permission space;
第一获取单元403,用于若是,则获取所述权限空间对应的权限变量;所述权限变量表征所述权限操作的属性;A first acquisition unit 403 is configured to acquire a permission variable corresponding to the permission space, wherein the permission variable represents a property of the permission operation;
第二获取单元404,用于根据所述权限空间序号获取权限变量值;A second acquisition unit 404 is used to acquire the permission variable value according to the permission space sequence number;
第二判断单元405,用于判断所述权限变量值与所述角色的预设权限变量值是否相同;The second judgment unit 405 is used to judge whether the authority variable value is the same as the preset authority variable value of the role;
生成单元406,用于若是,则生成权限信号。The generating unit 406 is configured to generate a permission signal if yes.
本发明具体实施例还提供一种基于RBAC的权限控制模型的建立方法,如图5所示,所述方法还包括:The specific embodiment of the present invention further provides a method for establishing a permission control model based on RBAC, as shown in FIG5 , the method further includes:
步骤501,建立权限空间,所述权限空间为权限控制点。具体的,权限空间为最小粒度的权限控制点,代表控制权限的细粒度划分至权限空间。把用户的权限划分成若干个原子粒度的权限空间以通过权限空间定义用户的多个权限,提供了权限控制的细粒度,使得在授予权限时更加精准。Step 501, establish a permission space, which is a permission control point. Specifically, the permission space is the permission control point with the smallest granularity, representing the fine-grained division of control permissions into the permission space. Dividing the user's permissions into several atomic granularity permission spaces to define multiple permissions of the user through the permission space provides fine-grained permission control, making it more accurate when granting permissions.
步骤502,建立角色,并建立用户与角色的关联关系以及所述角色与所述权限空间的关联关系。具体的,用户与角色可以一一对应或者多对多,即同一个用户在不同情形下可能具有不同的角色,而不同的角色又与不同的权限空间具有映射关系,且角色与权限空间也可以一一对应或者多对多,即一个角色具有不同的权限空间,一个权限空间也可以对应多个角色。这样建立一个用户与一个或多个角色的关联关系,在不同角色下又建立角色与多个权限空间的关联关系。Step 502, establish roles, and establish associations between users and roles, and between the roles and the permission spaces. Specifically, users and roles can correspond one-to-one or many-to-many, that is, the same user may have different roles in different situations, and different roles have mapping relationships with different permission spaces, and roles and permission spaces can also correspond one-to-one or many-to-many, that is, one role has different permission spaces, and one permission space can also correspond to multiple roles. In this way, an association between a user and one or more roles is established, and an association between a role and multiple permission spaces is established under different roles.
步骤503,建立权限变量,并建立所述权限空间与权限变量的关联关系。具体的,权限变量是权限控制属性,具体可以是功能权限控制属性或数据权限控制属性,单独的权限变量无法构成一个可执行的具体权限,而需一个权限空间下对应的多个权限变量组合才可以实现某一具体的权限。在权限空间这个最小粒度的权限控制点下建立权限变量这个灵活的权限控制属性,以此来进一步解决权限的精确性和细粒度问题。具体的,权限空间通常将一个或多个权限变量组合在一起控制具体的操作权限。其中,权限空间与权限变量可以是一对多或者多对多的关系,具体根据需要进行创建。Step 503, establish permission variables, and establish an association relationship between the permission space and the permission variables. Specifically, permission variables are permission control attributes, which can be functional permission control attributes or data permission control attributes. A single permission variable cannot constitute an executable specific permission, and a combination of multiple permission variables corresponding to a permission space is required to achieve a specific permission. Under the permission control point of the smallest granularity, the permission variable is established as a flexible permission control attribute to further solve the accuracy and granularity of permissions. Specifically, the permission space usually combines one or more permission variables to control specific operating permissions. Among them, the permission space and the permission variable can be a one-to-many or many-to-many relationship, which is created according to specific needs.
步骤504,设置所述权限变量对应的一个或多个权限变量值;Step 504, setting one or more permission variable values corresponding to the permission variable;
步骤505,建立所述权限变量值与所述权限空间序号的对应关系。具体的,所述权限变量可以包含一个或多个权限变量值,权限变量值在初始设置时通过对权限变量值的赋值范围进行限制另其满足用户需求并明确角色的具体作用,并将权限变量的不同权限变量值与权限空间序号进行一一配对。Step 505, establish a corresponding relationship between the permission variable value and the permission space serial number. Specifically, the permission variable may include one or more permission variable values. When the permission variable value is initially set, the assignment range of the permission variable value is limited to meet the user's needs and clarify the specific role of the role, and the different permission variable values of the permission variable are matched with the permission space serial number one by one.
本发明上述实施例建立的权限控制模型,将权限空间定义为最小的权限控制点,并通过用户、角色以及权限空间的相互关联关系对权限范围进行划分,以此来解决权限的精确性和细粒度问题,实现权限的精准控制。The permission control model established in the above embodiment of the present invention defines the permission space as the smallest permission control point, and divides the permission scope according to the mutual relationship between users, roles and permission space, so as to solve the accuracy and granularity problems of permissions and realize precise control of permissions.
本发明具体实施例所述的一种基于RBAC的权限控制模型的建立方法还包括:建立与所述权限空间对应的资源;所述资源表征需要进行权限控制的事件。具体的,资源可以是任何需要控制权限的事件,例如信息系统的菜单、网关上的端口号、视屏网站的视频等。以ERP系统为例,资源可以指系统的菜单、接口、报表等,菜单可以是“物资采购管理”、“物资库存管理”等菜单,接口可以是“物资查询”,“物资添加”、“物资修改”等接口。本实施例不同于上述实施例,权限空间与角色之间通过资源连通,即角色与资源、资源与权限空间分别具有关联关系,例如角色与资源具有关联关系,资源与权限空间具有关联关系,以便通过不同的资源增加权限控制的精细度。A method for establishing a permission control model based on RBAC described in a specific embodiment of the present invention also includes: establishing resources corresponding to the permission space; the resources represent events that require permission control. Specifically, resources can be any event that requires permission control, such as a menu of an information system, a port number on a gateway, a video on a video website, etc. Taking the ERP system as an example, resources can refer to menus, interfaces, reports, etc. of the system. Menus can be menus such as "Material Procurement Management" and "Material Inventory Management", and interfaces can be interfaces such as "Material Query", "Material Addition", and "Material Modification". This embodiment is different from the above embodiment. The permission space and the role are connected through resources, that is, the role and the resource, and the resource and the permission space have an association relationship respectively. For example, the role and the resource have an association relationship, and the resource and the permission space have an association relationship, so as to increase the precision of permission control through different resources.
本发明具体实施例所述的一种基于RBAC的权限控制模型的建立方法还包括所述方法包括:A method for establishing a permission control model based on RBAC according to a specific embodiment of the present invention also includes:
建立时效对象。具体的实施例中,时效对象是对其所属的对象有效性的定义,可以是一段时间、几个条件或特定环境等。Establishing a time-effect object: In a specific embodiment, a time-effect object is a definition of the validity of the object to which it belongs, which can be a period of time, several conditions or a specific environment.
建立时效对象与对象之间的关联关系,所述时效对象用于定义所述对象的有效性;所述对象包括:用户、角色、资源、权限空间、权限变量、用户与角色的对应关系、角色与资源的对应关系、资源与权限空间的对应关系、角色与权限空间的对应关系以及权限空间与权限变量的对应关系。在本发明具体实施例中,时效对象可以作用于模型中的所有对象或者部分对象,对象既包括用户、角色、资源、权限空间以及权限变量,还包括用户与角色的对应关系、角色与资源的对应关系、资源与权限空间的对应关系、角色与权限空间的对应关系以及权限空间与权限变量的对应关系。通过以上具体的实施例,系统管理员或运营人员可以随时对对象的时效性进行创建和修改,在达到时效要求时,权限自动生效或失效,不必按时手动操作,这样大大提高了系统的安全性和高效性。Establish an association relationship between a time-limited object and an object, the time-limited object is used to define the validity of the object; the object includes: users, roles, resources, permission spaces, permission variables, the correspondence between users and roles, the correspondence between roles and resources, the correspondence between resources and permission spaces, the correspondence between roles and permission spaces, and the correspondence between permission spaces and permission variables. In a specific embodiment of the present invention, the time-limited object can act on all objects or part of the objects in the model, and the objects include users, roles, resources, permission spaces, and permission variables, as well as the correspondence between users and roles, the correspondence between roles and resources, the correspondence between resources and permission spaces, the correspondence between roles and permission spaces, and the correspondence between permission spaces and permission variables. Through the above specific embodiments, system administrators or operators can create and modify the timeliness of objects at any time. When the timeliness requirements are met, the permissions automatically take effect or become invalid, and there is no need to manually operate on time, which greatly improves the security and efficiency of the system.
本发明具体实施例还提供一种基于RBAC的权限控制模型的建立装置,如图6所示,所述装置包括:The specific embodiment of the present invention further provides a device for establishing a permission control model based on RBAC, as shown in FIG6 , the device includes:
第一建立单元601,用于建立权限空间;所述权限空间为权限控制点;A first establishing unit 601 is used to establish an authority space; the authority space is an authority control point;
第二建立单元602,用于建立角色,并建立用户与角色的关联关系以及所述角色与所述权限空间的关联关系;The second establishing unit 602 is used to establish a role, and establish an association relationship between a user and a role, and an association relationship between the role and the permission space;
第三建立单元603,用于建立权限变量,并建立所述权限空间与权限变量的关联关系;The third establishing unit 603 is used to establish an authority variable and establish an association relationship between the authority space and the authority variable;
设置单元604,用于设置所述权限变量对应的一个或多个权限变量值;A setting unit 604, configured to set one or more permission variable values corresponding to the permission variable;
第四建立单元605,用于建立所述权限变量值与所述权限空间序号的对应关系。The fourth establishing unit 605 is used to establish a corresponding relationship between the permission variable value and the permission space sequence number.
本发明还提供一具体的实施例。首先,根据权限空间与权限变量的关联关系建立权限空间下要控制的权限变量,随后确认权限变量可赋予的权限变量值并与权限空间序号进行一一对应。例如,确认以下权限变量及其可赋予的权限变量值:The present invention also provides a specific embodiment. First, the permission variable to be controlled under the permission space is established according to the association relationship between the permission space and the permission variable, and then the permission variable value that can be assigned to the permission variable is confirmed and corresponds one-to-one with the permission space sequence number. For example, the following permission variables and the permission variable values that can be assigned are confirmed:
权限变量功能按钮(v_button)代表物料采购管理页面的功能按钮,可取的权限变量值为查询采购定单(query)、添加采购定单(add)、修改采购定单(edit)和删除采购定单(del)按钮等。The permission variable function button (v_button) represents the function button of the material procurement management page. The possible permission variable values are query purchase order (query), add purchase order (add), modify purchase order (edit) and delete purchase order (del) buttons, etc.
权限变量工厂(v_factory)代表企业或工厂,可取的权限变量值为大庆石化企业(F001)、大庆采油一厂(F001002001),大庆采油二厂(F001002002),大庆炼化三厂(F001003003)等。The authority variable factory (v_factory) represents an enterprise or factory. The possible authority variable values are Daqing Petrochemical Enterprise (F001), Daqing Oil Production Plant No. 1 (F001002001), Daqing Oil Production Plant No. 2 (F001002002), Daqing Refining and Chemical Plant No. 3 (F001003003), etc.
权限变量物料类型(v_materil_type)代表工业物料的种类,可取的权限变量值为重轨(M001)、轻轨(M002)、大工字钢(M003)和H型钢(M004)等。The authority variable material type (v_materil_type) represents the type of industrial material. The possible authority variable values are heavy rail (M001), light rail (M002), large I-beam (M003) and H-beam (M004).
此时权限空间s_materil拥有权限变量v_button、v_factory和v_materil_type。At this time, the permission space s_materil has the permission variables v_button, v_factory and v_materil_type.
可选的实施例中,还包括建立角色、角色包含的资源、资源对应的权限空间以及权限空间对应的权限空间序号,同时对权限空间下的权限变量赋值权限变量值,以明确角色的具体作用。例如建立如下表一中的对象:In an optional embodiment, it also includes establishing roles, resources included in roles, permission spaces corresponding to resources, and permission space serial numbers corresponding to permission spaces, and assigning permission variable values to permission variables under permission spaces to clarify the specific role of the role. For example, the objects shown in Table 1 are established as follows:
表一Table I
建立用户与角色的关联关系。例如将角色A赋予操作员甲,角色B、角色C和角色D赋予操作员乙,角色B、角色D和角色E赋予操作员丙。Establish the association between users and roles. For example, assign role A to operator A, assign roles B, C, and D to operator B, and assign roles B, D, and E to operator C.
可选的实施例中,还包括创建时效对象并对时效对象创建模型和算法。例如以时间段来建模,模型包含开始时间和结束时间两个条件,如果当前时间在开始时间和结束时间范围内,则确认为有效,否则为无效。具体的实施例中,建立时效对象与用户、用户与角色的关系、角色、角色与资源的关系、资源、资源与权限空间的关系、角色与权限空间的关系、权限空间、权限空间与权限变量的关系和权限变量的关系,根据事物特性的不同建立相应的时效对象。如图7所示,创建时效对象,以时效属性来建模,模型包含开始时间和结束时间两个属性,属性赋值开始时间为2022-05-01,结束时间的属性赋值为2022-05-02;或者开始时间为2023-12-01,结束时间为2023-12-08,如果当前时间在开始时间和结束时间范围内,则确认为有效,否则为无效。随后建立时效对象与用户、用户与角色的关系、角色、角色与资源的关系、资源、资源与权限空间的关系、角色与权限空间的关系、权限空间、权限空间与权限变量的关系和权限变量的关系,根据事物特性的不同建立相应的时效对象。例如给角色添加角色的时效对象M,给用户与角色的关系添加时效对象M等。In an optional embodiment, it also includes creating a time-limited object and creating a model and algorithm for the time-limited object. For example, the model is modeled with a time period, and the model includes two conditions: the start time and the end time. If the current time is within the start time and the end time, it is confirmed to be valid, otherwise it is invalid. In a specific embodiment, the relationship between the time-limited object and the user, the user and the role, the role, the role and the resource, the resource, the resource and the permission space, the role and the permission space, the permission space, the permission space and the permission variable, and the permission variable are established, and the corresponding time-limited object is established according to the different characteristics of the thing. As shown in Figure 7, a time-limited object is created and modeled with time-limited attributes. The model includes two attributes, the start time and the end time. The attribute assignment start time is 2022-05-01, and the end time attribute assignment is 2022-05-02; or the start time is 2023-12-01, and the end time is 2023-12-08. If the current time is within the start time and the end time, it is confirmed to be valid, otherwise it is invalid. Then, establish the relationship between time-limited objects and users, users and roles, roles, roles and resources, resources, resources and permission spaces, roles and permission spaces, permission spaces, permission spaces and permission variables, and permission variables, and establish corresponding time-limited objects according to the different characteristics of things. For example, add a time-limited object M of the role to the role, and add a time-limited object M to the relationship between the user and the role.
较佳的,将创建的用户、角色等数据用统一的数据格式保存为一份完整的文件并进行保存或复制,在应用用户权限数据时直接通用用户标识去缓存中获取,省去了数据的组合、运算过程,本实施例将这个过程放在事前处理,提高了权限的运行效率。较佳的,数据格式为json格式。Preferably, the created user, role and other data are saved as a complete file in a unified data format and saved or copied. When applying user authority data, the universal user ID is directly used to obtain it from the cache, eliminating the data combination and calculation process. This embodiment puts this process in advance processing to improve the operating efficiency of the authority. Preferably, the data format is json format.
为了说明本发明实施例的权限控制方法,本发明还提供一具体的实施例。操作员丙的功能权限算法,操作员丙拥有角色B、角色D和角色E,在将添加采购定单保存到数据库前要进行操作权限检查。首先检查角色B、角色D和角色E的时效对象是否有效,假设全有效,然后检查操作员丙是否拥有创建物料采购管理s_materil权限空间,因为角色B、角色D和角色E中都拥有创建物料采购管理s_materil权限空间,那么进行下一步需要检查采购定单填写的值是否满足用户角色要求,如果表单上填写的工厂为大庆采油一厂(F001002001),物料为重轨(M001),操作为添加采购定单(add),那么先检查角色B中权限空间序号s_materil_1对应的权限变量v_button的权限变量值为query,且query!=add,即角色B不符合条件。再看角色D中权限空间序号s_materil_1对应的权限变量v_button的权限变量值为add,符合要求,随后检查权限空间序号s_materil_1对应的权限变量v_factory的权限变量值为F001002002,因为F001002002!=F001002001,所以角色D不符合条件,最后查看角色E中权限空间序号s_materil_1对应的权限变量v_button权限变量值为query,因为query!=add,所以角色E不符合条件。所有角色都不符合要求,最终操作员丙无添加工厂为大庆采油一厂(F001002001),物料为重轨(M001)采购定单的权限。同样的算法,如果表单上填写的工厂为大庆采油二厂(F001002002),物料为重轨(M001),操作为添加采购定单(add),那么操作员丙的角色D符合要求,所以操作员丙有操作权限。In order to illustrate the authority control method of the embodiment of the present invention, the present invention also provides a specific embodiment. The function authority algorithm of operator C, operator C has role B, role D and role E, and before adding the purchase order to the database, an operation authority check is required. First, check whether the time-limited objects of role B, role D and role E are valid, assuming that all are valid, and then check whether operator C has the permission space for creating material procurement management s_materil, because role B, role D and role E all have the permission space for creating material procurement management s_materil, then the next step needs to check whether the value filled in the purchase order meets the user role requirements, if the factory filled in on the form is Daqing Oil Production Plant No. 1 (F001002001), the material is heavy rail (M001), and the operation is to add a purchase order (add), then first check that the permission variable value of the permission variable v_button corresponding to the permission space sequence number s_materil_1 in role B is query, and query! = add, that is, role B does not meet the conditions. Then check the permission variable v_button corresponding to the permission space number s_materil_1 in role D, the permission variable value is add, which meets the requirements. Then check the permission variable v_factory corresponding to the permission space number s_materil_1, the permission variable value is F001002002, because F001002002!=F001002001, so role D does not meet the conditions. Finally, check the permission variable v_button corresponding to the permission space number s_materil_1 in role E, the permission variable value is query, because query!=add, so role E does not meet the conditions. All roles do not meet the requirements. Finally, operator C does not have the permission to add the factory is Daqing Oil Production Plant No. 1 (F001002001), and the material is heavy rail (M001) purchase order. Using the same algorithm, if the factory filled in on the form is Daqing Oil Production Plant No. 2 (F001002002), the material is heavy rail (M001), and the operation is to add a purchase order (add), then operator C's role D meets the requirements, so operator C has the authority to operate.
下面再以数据权限为例,对本发明具体实施例进行介绍。假设数据库的采购定单表中有如下表二中的数据:The following is an introduction to a specific embodiment of the present invention by taking data permissions as an example. Assume that the purchase order table in the database contains the data shown in Table 2 below:
表二Table II
操作员丙拥有角色B、角色D和角色E,在查询采购定单时要进行数据权限检查,首先检查角色B、角色D和角色E的时效对象是否有效,假设全有效,然后检查操作员丙是否拥有s_materil权限空间,因为角色B、角色D和角色E中都拥有s_materil权限空间,所以第一步通过检查,第二步取出数据库表中所有的数据,先检查第1条数据是否符合要求,因为第1条数据的权限操作为查询,所以第1条数据对应到权限变量的各个权限变量值为v_button=query,v_factory=F001002001,v_materil_type=M001,用此值与角色B、角色D、角色E中的值比较,如果三个权限变量的变量值都满足要求,则操作员丙可以查看此条数据。循环角色进行对比,因为角色B满足要求,所以操作员丙可以查看此条数据。依次类推,发现第4条数据对应到的权限变量值为v_button=query,v_factory=F001003003,v_materil_type=M002在与角色B、角色D、角色E所应对用户的预设权限变量值比较时都不满足要求,所以不能查看此条数据,没有此条数据的权限。那么最终操作丙能获取的数据如下表三所示:Operator C has roles B, D, and E. When querying purchase orders, data permissions must be checked. First, check whether the time-limited objects of roles B, D, and E are valid. Assume that all are valid. Then check whether operator C has the s_materil permission space. Since roles B, D, and E all have the s_materil permission space, the first step passes the check. The second step takes out all the data in the database table. First, check whether the first data meets the requirements. Since the permission operation of the first data is query, the permission variable values of the first data corresponding to the permission variable are v_button=query, v_factory=F001002001, and v_materil_type=M001. Compare this value with the values in roles B, D, and E. If the variable values of the three permission variables meet the requirements, operator C can view this data. Loop through the roles for comparison. Since role B meets the requirements, operator C can view this data. By analogy, it is found that the permission variable values corresponding to the 4th data are v_button = query, v_factory = F001003003, v_materil_type = M002, which do not meet the requirements when compared with the preset permission variable values of the corresponding users of role B, role D, and role E. Therefore, this data cannot be viewed and there is no permission for this data. The data that can be obtained by the final operation C is shown in Table 3 below:
表三Table 3
如图8所示为本文实施例提供的一种计算机设备,本文实施例中权限控制装置可以为本实施例中的计算机设备,执行本文的上述方法。所述计算机设备802可以包括一个或多个处理器804,诸如一个或多个中央处理单元(CPU),每个处理单元可以实现一个或多个硬件线程。计算机设备802还可以包括任何存储器806,其用于存储诸如代码、设置、数据等之类的任何种类的信息。非限制性的,比如,存储器806可以包括以下任一项或多种组合:任何类型的RAM,任何类型的ROM,闪存设备,硬盘,光盘等。更一般地,任何存储器都可以使用任何技术来存储信息。进一步地,任何存储器可以提供信息的易失性或非易失性保留。进一步地,任何存储器可以表示计算机设备802的固定或可移除部件。在一种情况下,当处理器804执行被存储在任何存储器或存储器的组合中的相关联的指令时,计算机设备802可以执行相关联指令的任一操作。计算机设备802还包括用于与任何存储器交互的一个或多个驱动机构808,诸如硬盘驱动机构、光盘驱动机构等。As shown in FIG8 , a computer device provided in an embodiment of this invention is shown. In an embodiment of this invention, the permission control device can be a computer device in this embodiment, and the above method of this invention is executed. The computer device 802 may include one or more processors 804, such as one or more central processing units (CPUs), and each processing unit may implement one or more hardware threads. The computer device 802 may also include any memory 806, which is used to store any kind of information such as code, settings, data, etc. Non-limitingly, for example, the memory 806 may include any one or more combinations of the following: any type of RAM, any type of ROM, flash memory device, hard disk, optical disk, etc. More generally, any memory may use any technology to store information. Further, any memory may provide volatile or non-volatile retention of information. Further, any memory may represent a fixed or removable component of the computer device 802. In one case, when the processor 804 executes an associated instruction stored in any memory or a combination of memories, the computer device 802 may perform any operation of the associated instruction. The computer device 802 also includes one or more drive mechanisms 808 for interacting with any memory, such as a hard disk drive mechanism, an optical disk drive mechanism, etc.
计算机设备802还可以包括输入/输出模块810(I/O),其用于接收各种输入(经由输入设备812)和用于提供各种输出(经由输出设备814)。一个具体输出机构可以包括呈现设备816和相关联的图形用户接口(GUI)818。在其他实施例中,还可以不包括输入/输出模块810(I/O)、输入设备812以及输出设备814,仅作为网络中的一台计算机设备。计算机设备802还可以包括一个或多个网络接口820,其用于经由一个或多个通信链路822与其他设备交换数据。一个或多个通信总线824将上文所描述的部件耦合在一起。The computer device 802 may also include an input/output module 810 (I/O) for receiving various inputs (via input devices 812) and for providing various outputs (via output devices 814). A specific output mechanism may include a presentation device 816 and an associated graphical user interface (GUI) 818. In other embodiments, the input/output module 810 (I/O), the input device 812, and the output device 814 may not be included, and the computer device 802 may be used as a computer device in a network. The computer device 802 may also include one or more network interfaces 820 for exchanging data with other devices via one or more communication links 822. One or more communication buses 824 couple the components described above together.
通信链路822可以以任何方式实现,例如,通过局域网、广域网(例如,因特网)、点对点连接等、或其任何组合。通信链路822可以包括由任何协议或协议组合支配的硬连线链路、无线链路、路由器、网关功能、名称服务器等的任何组合。The communication link 822 may be implemented in any manner, for example, through a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 822 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.
本发明实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现上述任意一种权限控制方法的步骤和/或,任一项所述的基于RBAC的权限控制模型的建立方法。An embodiment of the present invention also provides a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any of the above-mentioned permission control methods and/or any of the methods for establishing an RBAC-based permission control model.
应理解,在本文的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本文实施例的实施过程构成任何限定。It should be understood that in the various embodiments of this document, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this document.
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to the flowchart and/or block diagram of the method, device (system) and computer program product according to the embodiment of the present application. It should be understood that each process and/or box in the flowchart and/or block diagram, and the combination of the process and/or box in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for realizing the function specified in one process or multiple processes in the flowchart and/or one box or multiple boxes in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
前述对本发明的具体示例性实施方案的描述是为了说明和例证的目的。这些描述并非想将本发明限定为所公开的精确形式,并且很显然,根据上述教导,可以进行很多改变和变化。对示例性实施例进行选择和描述的目的在于解释本发明的特定原理及其实际应用,从而使得本领域的技术人员能够实现并利用本发明的各种不同的示例性实施方案以及各种不同的选择和改变。本发明的范围意在由权利要求书及其等同形式所限定。The foregoing description of specific exemplary embodiments of the present invention is for the purpose of illustration and demonstration. These descriptions are not intended to limit the present invention to the precise form disclosed, and it is clear that many changes and variations can be made based on the above teachings. The purpose of selecting and describing the exemplary embodiments is to explain the specific principles of the present invention and its practical application, so that those skilled in the art can realize and utilize various different exemplary embodiments of the present invention and various different selections and changes. The scope of the present invention is intended to be limited by the claims and their equivalents.
Claims (13)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211421260.7A CN118036023B (en) | 2022-11-14 | 2022-11-14 | RBAC-based authority control method, and method and device for establishing model |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211421260.7A CN118036023B (en) | 2022-11-14 | 2022-11-14 | RBAC-based authority control method, and method and device for establishing model |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN118036023A true CN118036023A (en) | 2024-05-14 |
| CN118036023B CN118036023B (en) | 2025-08-15 |
Family
ID=90986524
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202211421260.7A Active CN118036023B (en) | 2022-11-14 | 2022-11-14 | RBAC-based authority control method, and method and device for establishing model |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN118036023B (en) |
Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20060130150A1 (en) * | 2004-12-09 | 2006-06-15 | Garza-Gonzalez Daniel C | Context-sensitive authorization |
| CN1885297A (en) * | 2006-06-02 | 2006-12-27 | 石杰 | Method for role-based access control model with precise access control strategy |
| US20070283443A1 (en) * | 2006-05-30 | 2007-12-06 | Microsoft Corporation | Translating role-based access control policy to resource authorization policy |
| CN101571897A (en) * | 2009-06-04 | 2009-11-04 | 浙江大学 | Method for controlling access permission of massive objects in computer system |
| CN103078859A (en) * | 2012-12-31 | 2013-05-01 | 普天新能源有限责任公司 | Service system authority management method, equipment and system |
| CN110569667A (en) * | 2019-09-10 | 2019-12-13 | 北京字节跳动网络技术有限公司 | Access control method and device, computer equipment and storage medium |
| CN112906028A (en) * | 2021-03-04 | 2021-06-04 | 广州虎牙科技有限公司 | Access control method, device, electronic equipment and computer readable storage medium |
| CN113282896A (en) * | 2021-06-11 | 2021-08-20 | 上海数禾信息科技有限公司 | Authority management method and system |
-
2022
- 2022-11-14 CN CN202211421260.7A patent/CN118036023B/en active Active
Patent Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20060130150A1 (en) * | 2004-12-09 | 2006-06-15 | Garza-Gonzalez Daniel C | Context-sensitive authorization |
| US20070283443A1 (en) * | 2006-05-30 | 2007-12-06 | Microsoft Corporation | Translating role-based access control policy to resource authorization policy |
| CN1885297A (en) * | 2006-06-02 | 2006-12-27 | 石杰 | Method for role-based access control model with precise access control strategy |
| CN101571897A (en) * | 2009-06-04 | 2009-11-04 | 浙江大学 | Method for controlling access permission of massive objects in computer system |
| CN103078859A (en) * | 2012-12-31 | 2013-05-01 | 普天新能源有限责任公司 | Service system authority management method, equipment and system |
| CN110569667A (en) * | 2019-09-10 | 2019-12-13 | 北京字节跳动网络技术有限公司 | Access control method and device, computer equipment and storage medium |
| CN112906028A (en) * | 2021-03-04 | 2021-06-04 | 广州虎牙科技有限公司 | Access control method, device, electronic equipment and computer readable storage medium |
| CN113282896A (en) * | 2021-06-11 | 2021-08-20 | 上海数禾信息科技有限公司 | Authority management method and system |
Non-Patent Citations (1)
| Title |
|---|
| 蒋友毅;宋靖宇;钟华;: "P-RBAC:一种门户环境下的访问控制模型", 计算机工程与应用, no. 12, 21 April 2007 (2007-04-21) * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN118036023B (en) | 2025-08-15 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11985131B2 (en) | Descendent case role alias | |
| CN109522707B (en) | Role and resource-based user data read-write security authority control method and system | |
| CN108351771B (en) | Maintain control over restricted data during deployment to a cloud computing environment | |
| US11231912B2 (en) | Post-deployment modification of information-technology application using lifecycle blueprint | |
| CN110851127A (en) | Universal evidence storage method based on block chain | |
| CN107526766A (en) | Data organization method and development environment system | |
| CN111464487B (en) | Access control method, device and system | |
| CN114239035B (en) | Collaborative process execution system based on block chain and data access control method thereof | |
| WO2020007132A1 (en) | Resource access control method and device | |
| Ding et al. | Manufacturing system under I4. 0 workshop based on blockchain: Research on architecture, operation mechanism and key technologies | |
| CN117633828A (en) | Data access control method, device and medium based on semantic support | |
| JP6708083B2 (en) | Application development environment providing system, application development environment providing method, application development environment providing program, and terminal device | |
| JP2022003591A (en) | Device, method, and program for affiliation management | |
| CN110348184B (en) | Industrial cloud-based permission resource configuration method, system and storage medium | |
| CN118036023B (en) | RBAC-based authority control method, and method and device for establishing model | |
| CN112686580B (en) | Workflow definition method and system capable of customizing flow | |
| CN113746684A (en) | Network equipment management method and device, computer equipment and storage medium | |
| CN119830313A (en) | Rights control system, rights control method, rights control apparatus, computer device, and storage medium | |
| WO2021203817A1 (en) | Open interface management method, electronic device, and storage medium | |
| US8429193B2 (en) | Security control of analysis results | |
| WO2024213403A1 (en) | Digital twin generation using streaming of chemical product data | |
| CN114331185A (en) | Subject processing method, device and equipment based on subject table | |
| Andalib et al. | SCAC: Smart Contract-Based Access Control in IoT | |
| CN112789596A (en) | Processing method and device for task processing request and block chain node equipment | |
| US20250158988A1 (en) | Data provisioning using application programming interfaces |
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 | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |