Rights Management System-table data
In this section, we insert the data to look at the data flow, so that the students, know how this permission table interaction is a process, so that everyone the day after tomorrow fog into the fog
First, I'll explain some of the tables, Sysuser and Sysrole tables without explanation.
Sysrolesysuser: This is the role and the user's corresponding table a role can correspond to multiple users, a user can correspond to multiple roles
Sysmoduleoperate: The Operation code table for the module, I think of each action as an opcode, or each method can be considered as an opcode
Sysright: This is the relationship table for roles and modules, and only the roles authorized by the module can set permissions
Sysrightoperate: This is a character-owned opcode, this table is related to the opcode indirectly
Now we're going to insert some data to look at the relationship between them, we sysmodule this table already has the data, we still take syssample, run through this, other nature will pass
(source code has been released to the 17th lecture, the children are interested in the QQ group share 37509873, and then 17 to modify a problem, you see 17 of the message section)
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/aspx/
Insert opcode for sysmoduleoperate
INSERT into [sysmoduleoperate] ([Id],[name],[keycode],[moduleid],[isvalid],[sort]) VALUES (' Basesamplecreate ', ' Creation ', ' Create ', ' basesample ', 0,0 ' INSERT into [sysmoduleoperate] ([Id],[name],[keycode],[moduleid],[isvalid],[sort]) VALUES (' Basesampledelete ', ' delete ', ' delete ', ' basesample ', 0,0) INSERT into [Sysmoduleoperate] ([id],[name],[keycode],[ Moduleid],[isvalid],[sort] VALUES (' basesampledetails ', ' detailed ', ' details ', ' basesample ', 0,0) INSERT into [ Sysmoduleoperate] ([Id],[name],[keycode],[moduleid],[isvalid],[sort]) VALUES (' Basesampleedit ', ' Editors ', ' edit ', ' Basesample ', 0,0) INSERT into [Sysmoduleoperate] ([Id],[name],[keycode],[moduleid],[isvalid],[sort]) VALUES (' Basesampleexport ', ' exporting ', ' export ', ' basesample ', 0,0) INSERT into [Sysmoduleoperate] ([Id],[name],[keycode],[moduleid] , [Isvalid],[sort]) VALUES (' Basesamplequery ', ' Queries ', ' query ', ' basesample ', 0,0) INSERT into [Sysmoduleoperate] ([id],[ Name],[keycode],[moduleid],[isvalid],[sort] VALUES (' Basesamplesave ', ' saving ', ' save ', ' basesample ', 0,0)
You can see that moduleid corresponds to a sample program that sysmodule this table id,isvalid whether you want to verify
Inserts a role group into the table Sysrole
INSERT into [Sysrole] ([Id],[name],[description],[createtime],[createperson]) VALUES (' Administrator ', ' super admin ', ' All authorized ', ' 1 12:00am ', ' Administrator '
Authorize the module to Sysright
INSERT into [Sysright] ([Id],[moduleid],[roleid],[rightflag]) VALUES (' Administratorsamplefile ', ' samplefile ', ' Administrator ', 1)
INSERT into [Sysright] ([Id],[moduleid],[roleid],[rightflag]) VALUES (' Administratorbasesample ', ' basesample ', ' Administrator ', 1)
Assigning permissions to Roles Sysrightoperate
INSERT into [Sysrightoperate] ([id],[rightid],[keycode],[isvalid]) VALUES (' Administratorbasesamplecreate ', ' Administratorbasesample ', ' Create ', 1) INSERT into [Sysrightoperate] ([id],[rightid],[keycode],[isvalid]) VALUES (' Administratorbasesampledelete ', ' administratorbasesample ', ' Delete ', 1) INSERT into [Sysrightoperate] ([Id],[rightid] , [Keycode],[isvalid]) VALUES (' Administratorbasesampledetails ', ' administratorbasesample ', ' Details ', 1) INSERT into [ Sysrightoperate] ([id],[rightid],[keycode],[isvalid]) VALUES (' Administratorbasesampleedit ', ' Administratorbasesample ', ' Edit ', 1 INSERT into [sysrightoperate] ([id],[rightid],[keycode],[isvalid]) VALUES (' Administratorbasesampleexport ', ' administratorbasesample ', ' Export ', 1) INSERT into [Sysrightoperate] ([Id],[rightid] , [Keycode],[isvalid]) VALUES (' Administratorbasesamplequery ', ' administratorbasesample ', ' Query ', 1) INSERT into [ Sysrightoperate] ([id],[rightid],[keycode],[isvalid]) VALUES (' Administratorbasesamplesave ', ' Administratorbasesample ', ' SAve ', 1)
Assign the opcode to the role's permissions, such as the create Operation code, so the role has the permissions created
Create a user bar Sysuser
INSERT into [Sysuser] ([id],[username],[password],[truename],[card],[mobilenumber],[phonenumber],[qq],[ emailaddress],[othercontact],[province],[city],[village],[address],[state],[createtime],[createperson],[sex],[ birthday],[joindate],[marital],[political],[nationality],[native],[school],[professional],[degree],[depid],[ Posid],[expertise],[jobstate],[photo],[attach]
values (' admin ', ' admin ', ' 01-92-02-3a-7b-bd-73-25-05-16-f0-69-df-18-b5-00 ', ' System Administrator ', Null,null, ' 06638888888 ', ' 324345345 ', ' ymnets@sina.com ' , ' msn:ymnets ', ' 440000 ', ' 440100 ', ' 440101 ', ' Little Village ', 1, ' 3:40pm ', ' admin ', ' Man ', ' 1900 12:00am ', ' 1 2013 12:00am ', ' unmarried ', ' China ', ' China ', ' Guangdong Jieyang ', ' Harvard University ', ' Computer Engineering ', ' Master ', ' 20000 ', ' 20001 ', ' hardworking, friendly, helpful ', ' on-the-job ', null,null
There is an encrypted 01-92-02-3a-7b-bd-73-25-05-16-f0-69-df-18-b5-00 password, and when it comes to the user, there is a class of encryption.
Assign a role to the user Sysrolesysuser
INSERT into [Sysrolesysuser] ([Sysuserid],[sysroleid]) VALUES (' admin ', ' Administrator ')
Let's organize our thoughts:
adding modules
Add Module Operation code
Add role
Assigning module permissions to Roles
Assign permissions to roles, and permissions determine whether the module is displayed
Add user
Assigning roles to the user
Author: ymnets
Source: http://ymnets.cnblogs.com/