NHIBERNATE implementation of the system's permission control (1)
Data Object Analysis Permissions Management is the basic functionality that must have a general management system, and it must also be available. So prepare to design a function of permission management, because the time problem is placed in the UI section, it may not be completed, in order to learn new technology, it is decided to use NHibernate to do OR, of course, here only use some basic functions, delay loading, and Some of the functions of the external joint, there is no use in this attempt, have a bit busy in the recent work, there is no time during the day, only at night is a little time!
Do this, one is to learn NHibernate, familiar. Net, but also hope to communicate with you, it is best to make him a function of actual application together.
There is still no hand on the hand, most of them can only be expressed in TXT, I hope everyone will forgive me.
Well, we first make an abstract analysis in the authority of the class, the class action module user role
Action refers to an operation in the system, such as, new, deleted (and new, deleting different meanings), the action must belong to a certain one, or several modules.
Module refers to a collection of related functions in the system, such as purchase order, then we say it is a module and this module will have some movements, such as new, editing, delete ...
/ / Here you have to say that it is actually subdivided, or the module can make a job, or it is called large module // (purchasing orders) // currently do not discuss this situation, because such classification The relationship between authority allocation is not large.
Role permissions carrier, such as we can say that the role S will use the new power limit of the order. // The role is the owner of the permissions, and the different roles can be accommodated with each other. // Role A can be composed of role B and role C, and A has owned by B and C. // Currently this function is not considered
The user of the user system, huh, one user can have a plurality of roles, and use the user to have permissions in the system by assigning roles.
So sleepy, fascinating, don't know if you can understand? ? Ha ha
Ok, we can refine it, then determine the data structure / entity class. Data refinement
Calling mode Name Label Description CallTypes Code Name Label Memo
The way of calling, it is not necessary, we are mainly used here to use the action and module, for other operations, the use of benevolent people
Action number name label call mode Number Description Actions Code Name Label CallTypescode Memo
As mentioned earlier, CallTypescode is CALLTYPES's code.
Module Number Name Label Parent Module Type (Directory / Specific) Call Mode Number Description Last Modified Time Modules Code Name Label ParentModulescode Type CallTypescode Memo LastModify
As mentioned earlier, CallTypescode is CodeType's code, here to say, module table, should also add some extension fields, huh, this is waiting to start writing, one system framework is said, huh, huh It is really sleepy here, you should also understand it, haha, too sleepy, module action table number module number action number ModuleActions ID Modulescode ActionScode role Number name tag type (system / advanced / ordinary) Description Roles Code name label Type Memo user ID name tags gender department Title users Code name label sex department duty user roles table number user number character number UserRoles Id UsersCode RolesCode role permissions table [main] No. role numbering module number RolePermissionsMaster Code RolesCode ModulesCode role permissions table [ From] Number Subject No. Act No. RoleperMissionsDetail ID Masterscode ActionScode By the way, the current data access layer is basically completed, the logical layer is fast, there is a picture how to post, and where is the database script / program code? ?
There is also to facilitate debugging, our Solution is quoted, NHibernate's project (source code) hopes to publish it to everyone, everyone can have a mental preparation haha.