Build a backend management system for ASP. Mvc4+ef5+easyui+unity2.x Injection (18)-Rights Management system-table data

Source: Internet
Author: User

In this section, we insert data to look at the data flow, so that the students, know how this permission table interaction is a process, lest everyone in the fog in the fog to go in the day after tomorrow
First I'll explain some of the tables, Sysuser and Sysrole tables don't have to explain.

    • Sysrolesysuser: This is the corresponding table for the role and the user a role can correspond to multiple users, one user can correspond to multiple roles
    • Sysmoduleoperate: The opcode of the module, I think of each action as an opcode, or each method can be regarded as a opcode
    • Sysright: This is a relational table of roles and modules that can only be set by a role that is authorized by the module
    • Sysrightoperate: This is a role-owned opcode, which is indirectly associated with the opcode

Now we have to insert some data to see the relationship between them, we sysmodule the table already has data, we still take syssample, run through this, the other natural pass

(Source has been released to the 17th, the children's shoes are interested in the QQ group sharing 37509873, and then 17 said to modify a problem, you see 17 of the message part)

Insert opcode for sysmoduleoperate

 INSERT into [sysmoduleoperate] ([Id],[name],[keycode],[moduleid],[isvalid],[sort]) VALUES (' Basesamplecreate ', ' Creating ', ' 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 ', ' verbose ', ' details ', ' basesample ', 0,0) INSERT into [ Sysmoduleoperate] ([Id],[name],[keycode],[moduleid],[isvalid],[sort]) VALUES (' Basesampleedit ', ' editor ', ' 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 ', ' save ', ' save ', ' basesample ', 0,0) 

It can be seen that the ModuleID corresponds to the sysmodule of this table sample program Id,isvalid whether to verify
Insert 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 ')

Authorizing 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)

Assign permissions to the role 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 operation code to the role's permissions, such as the creation of the operation code, then the role has the rights to create
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 ', ' [email protected] ', ' msn:ymnets ', ' 440000 ', ' 440100 ', ' 440101 ', ' Little Village ', 1, '  3:40PM ', ' admin ', ' Male ', ' 1900 12:00AM ', ' 01  1 12:00AM ', ' unmarried ', ' China ', ' China ', ' Guangdong Jieyang ', ' Harvard University ', ' Computer Engineering ', ' Master ', ' 20000 ', ' 20001 ', ' hardworking, friendly, helpful ', ' in-service ', Null,null )

There is an encrypted 01-92-02-3a-7b-bd-73-25-05-16-f0-69-df-18-b5-00 password, which will be encrypted when it comes to the user.

Assigning roles to users Sysrolesysuser

INSERT into [Sysrolesysuser] ([Sysuserid],[sysroleid]) VALUES (' admin ', ' Administrator ')

Let's tidy up our ideas:

    • Add Module
    • Add Module Operation code
    • Add a role
    • Assigning module permissions to the role
    • Assign permissions to roles, and permissions determine whether the module is displayed
    • Add user
    • Assigning roles to users

Build a backend management system for ASP. Mvc4+ef5+easyui+unity2.x Injection (18)-Rights Management system-table data

Related Article

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.