JAVA Data Rights Design

Source: Internet
Author: User

Data rights design

Preface

In a variety of systems. To ensure the security of data objects and easy to operate, so that the enterprise's business units, functional departments can easily and efficiently work together, then a good data rights management design becomes a key issue. Although the workflow of each unit in the enterprise is different, the data objects processed are different, but there are many same places in the organization structure and information processing, which provides an abstract basis for the design of the data object's permission control.

The control of data permissions is different from that of the general function permission, and the General function permission refers to a user, a role or a user group can operate a certain function. The data permission refers to a user, role, or a user group to the extent of the operation of a data object, for example, user A can control the data objects completely. User B only has access to the data object. At the same time, data rights control belongs to the category of dynamic permission control.

Data rights design

In many of the current applications are related to rights management, the permissions are mainly divided into functional permissions and data permissions. As for the function is relatively simple, there are many implementations on the Internet. This is not covered here. Under the main discussion under the data permission design.

Data permissions are very different from functional permissions, and the granularity is very small. Throughout the development cycle of the project, it cannot be appended as a function permission at the end of the project. There are also some companies that have their own permissions components (functional permissions), and the completion of the project with the rights component is in effect.

Data permissions do not reach the component level and must be planned at the project design stage. Before looking at the same online people want to be based on the principle of spring section to achieve data permissions, so that the low-intrusion, low coupling, the idea is very good. But the reality is very bony, so that the entire application system efficiency greatly reduced discount, the same data access control strategy is also very inflexible.

Put forward your own design plan below. In the system, a data rights module, the module can be based on the current business module SQL, current operator information, the current permissions of the policy to proactively generate corresponding SQL statements with data rights to the business module to continue processing, for example, as seen:


Data Rights Design Analysis
SQL statements can be extended

Data permissions are often used as high-level behaviors for functional permissions. The ability to control the amplitude of a data object. For example, users can only see their orders, ordinary members do not see the advanced properties of a data Object (field) and so on. It is obviously impossible to deal with the result set when the granularity is so fine, and then it is only possible to intervene in the SQL statement, and at this point do not want to allow developers too much consideration of data permissions in the development phase. In this case, it is better to refer to the SQL statement in a configuration file, or database, the development phase only requires the developer through the Data Rights module interface calls to achieve the data permissions control SQL statement. This also calculates the low intrusion of the code.

SQL statement efficient parsing processing

One of the core of the data rights module is the efficient parsing of SQL statements, and SQL processing refers to generating an SQL statement with Data permission processing results based on the current login information and data rights policy. Therefore, the Analytic processing of SQL statements must require accurate and accurate. In the development phase by the developer to write SQL to the configuration file, in the execution phase by the data permissions to obtain the SQL for analysis processing (plus data permissions), so that the SQL assembly processing.

Data Rights policy Design

The most important place is the design of the data rights policy, which introduces several concepts first:

1, Resources: Data rights control objects, business system of various resources.

For example, order documents, sales orders, etc.

2. Subject: User, Department, role, etc.

3. Rules: Conditional rules for "Data permissions"

Here the side re-analysis of the subject and rules, the subject has a hierarchical relationship. Be able to set different rules for different subjects, for example: The current data is only valid for the creator (or someone), the permissions of the subordinate principals are equally valid for the parent principal (configurable, as can be checked), and the non-current body can only see part of the data (some data is optional).

Here are just a few examples of rules that need to be intact in the real world, depending on the enterprise environment or the project environment.

Data Rights policy optimization

Data permissions are the same category of permissions, each visit will go to request authentication permissions, so the authorization needs to be efficient, and then the algorithm can be written or memcache in order to improve response speed.

Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

JAVA Data Rights Design

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.