In addition, we hope you can get some inspiration from the demo address of online experience.
Address: http://121.40.148.178:8080/, user name: Guest, Password: 123456
First, preface
Rights Management is a very important module in the development framework, because each management system will involve the rights management, if our development framework of the rights module is done well, very flexible, then you can be in all projects to save a lot of time to reduce development costs.
This Boven provides a detailed introduction to the focus of authority development.
Second, the module management of permissions
A set of system will be composed of a function module, then the rights management at least to be able to control access to each function.
So in our backend system, how to integrate each function module into the Authority management?
In fact, the General function module is a menu item, that I put each menu item in the background registration, assign an ID, and then the ID with the user, the role of the association, it can be a good solution to the problem.
After the user login to get his role and then to find out which menu he has access to, then solved the function module permissions.
The core code can refer to the following code
/// <summary> ///Load Permissions module/// </summary> /// <param name= "ObjectId" >Object PRIMARY Key</param> /// <returns></returns> PublicList<base_module> Getmodulelist (stringObjectId) {StringBuilder strSQL=NewStringBuilder (); if(!ManageProvider.Provider.Current (). IsSystem) {strsql.append (@"SELECT DISTINCT m.* from Base_module M"); Strsql.append ("INNER JOIN base_modulepermission MP on M.moduleid = MP. ModuleID WHERE ObjectId in ('"+ ManageProvider.Provider.Current (). Objectid.replace (",","', '") +"')"); } Else{strsql.append (@"SELECT * from Base_module M"); } strsql.append ("ORDER by M.sortcode ASC"); returnDatafactory.database (). Findlistbysql<base_module>(Strsql.tostring ()); }
Very simple to get the user's permission, we can go through the list to load menu and permission validation.
Design interface Reference.
Module Join Frame Control
This module can be included in the management, but sometimes we will control the authority finer, not only the module need to control.
The function on the module also needs to be regulated, so we can add the button on the module to the control.
Data permissions also need to be regulated on certain occasions.
So we can also add the button on the module to the control object by the way of the module registration.
Then after registering the authorized object, we will have to authorize the user or role, here to talk about the role of the authorization method, in reality, the role of authorization is also used a lot.
First we set up roles, and then we specify which users have permissions for this role
When I set up a lot of roles, I would like to do a batch of authorization can be done as follows
Then, the point is, how to assign permissions to the role, because the button is included on the module, so the authorization of the module and the button can be
Authorization of data items
After this authorization is completed, the identity of an ordinary user can only be seen in the following pages
A module without permissions cannot operate at all.
In addition, we hope you can get some inspiration from the demo address of online experience.
Address: http://121.40.148.178:8080/, user name: Guest, Password: 123456
QQ Technology Group: 239168429
ASP. MVC4 Rapid Development Framework rights module Development Essentials