Permission management is a common feature. I think many "experts" in the blog Park have written related articles, but most of them are not empty talk theories, it's just a dummies and toys that have almost no real project practicality. A few RBAC-based design schemes are still acceptable, but they are still vague. When talking about the key implementation, they will be impotence, for fear that others will learn it.
Permission management is required for every project, but it is difficult to write it. Therefore, many people want to do the so-called "general permission management", but I think it is a little thunderous. Xian ge also wrote about the so-called general permissions, what is based on RBAC, and what resources + operations = permissions. It is flexible to achieve flexibility, and the result configuration is very complicated and not ideal for use in projects. In addition, the word "general" must be independent of platform technologies and projects, decoupling is implemented, and permissions are frequently accessed. Therefore, data transmission and efficiency become a major problem.
In addition, there are a lot of general permission requirements, and it is generally difficult to think about all of them. Although the technology is not good, I think this is the right way to collect permissions, at least this is better than some people who just write a toy and dare to claim "general permission.
So many times, let's talk about my permission management. As I mentioned above, I basically gave up the so-called general permission. Before the general permission management was revealed, I think it is feasible to write different permission management functions based on the characteristics of different projects. Therefore, I cannot say that this permission is limited to the MVC Framework and can be used to manage permissions that meet the needs of my project.
Because girI GE's permissions are always concealed, I think the Code he released is also very poor, and his general permissions do not know when to completely suppress it... so string brother brings all the demos and source code to everyone for comfort.
Due to the limited space, I will not explain how to access the database (the previous series have been described in detail), but I will not explain the EXTJS code (I will detail the typical application scenarios of EXTJS later ), I will not explain any code that has nothing to do with permissions. (If you are interested, I will introduce it in detail later ).
It's too tired to upload the demo at a.m... In the next article, I will introduce the detailed implementation ideas and code. All the executable source code will also be provided in the next article... some comments can be raised by some experts. I will explain it in the next article.
Although a demo is available, the following international conventions cannot be lost:
Online Demo:
Address: http: // 218.60.8.35: 1234/
Server: Netcom
Port: Do not disable port 1234.
Note: If you have connected to the database, there must be a loophole in a rush of time. Do not mess up the problem :)
Login User: 1. User name: Niu toutiao warrior password: 000000 permission: All menu pages are available, and database changes cannot be performed (the input experience is not affected)
2. User name: Tiger MM password: 000000 permission: There are two fewer menu pages, and the database cannot be changed (it does not affect the input experience)
3. User name: admin password no public permission: All Permissions
Note: The above implementation is configured through permission management s, without any hard encoding.
Applicable Projects:
MIS projects developed based on Asp. Net MVC and encoded strictly according to MVC ideas
Function module:
User Management
Department management
Role management
Menu management
Atcion-level function permission management
Login, logout, etc.
Key Overview:
Users and departments are many to many ..
Users and roles are many to many ..
Roles and menus are many to many ..
Role and Atcion are many to many ..
Roles can be inherited ..
Login is verified using the built-in Form ..
All data related to permission determination is cached ..
The menu is dynamically configured ..
Action permission maintenance is reflected to facilitate selection (permission judgment is not reflected )...
The boundary for determining the minimum permission is in the Action request...
The judgment logic is that the menu permission must be determined, and the fine-grained function permission of Action can be determined only when it is maintained...
Because it is Asp.net MVC + Ext, every operation (Action Request) on the basic page can be controlled. It must be able to meet the permission control granularity requirements of MIS projects...
Implemented through the custom MVC Filter (without the built-in AuthorizeAttribute )...
Limitations:
It can only be used under ASP. net mvc...
No data permission management (you can add it yourself... I think it would be nice to implement it using AOP )...
Extended functions such as multi-level authorization and single sign-on are not implemented (you can expand it yourself )...
Table Design: