Design of Asp.net MVC permissions (I) database creation

Source: Internet
Author: User

Currently, permission design has plagued us for a long time. For MVC, I will use ActionFilter to expand our permission authentication. The following example is extracted from one of my course center projects, I hope that this will serve as an example for beginners.

Next we will first design the database layer for permission control.

Next I will introduce the description of each field in sequence.

RoleGroup permission group table this table mainly groups system permissions. Our users can directly assign this group with all the permissions of this group.

RoleID permission group ID Example: 01

RoleName permission group name example: System Administrator

RoleState group status (Enabled or not) Example: True

 

RoleGroupAppList table group permissions corresponding to the table this table mainly copies the detailed list of permissions corresponding to each permission Group

ID primary key example: 1

ID of the permission group corresponding to the RoleID: 01

Example of detailed permission group ID corresponding to SysAppID: 01

StartTime: the start date of the permission, for example,. The default attribute of this field is all, that is, the start date is not limited.

EndTime: end date of the permission, for example,. The default attribute of this field is all, that is, the end date is not limited.

 

SysAppCate table this table is mainly used to classify SysAppList detailed permission tables. When there are many permission pages, this table is mainly used for convenient management. Omitted

SysAppCateID: 01

SysAppCateName: News management

SysAppCateEName

 

SysAppList permission Details table this table is mainly responsible for the basic list of all Permissions

SysAppID permission ID Example: 01

SysAppCateID permission category ID Example: 01

SysAppName permission name example: News Addition

SysAppEName permission English name

Example of a Controller with SysAppController permissions: News

SysAppAction: Add Action. This permission is designed to restrict Action permissions.

IsView is visible for example: True this field is designed to facilitate background management and settings, because some actions do not have a View layer, such as Post, but we need to use it in the background permission management.

 

Now, the database creation part is here. Next I will introduce the logic part, which will involve the Repository mode, cache, and custom AuthorizeAttribute.

 

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.