ASP. Net Core 2.0 Project Combat (2) Ncmvc a framework for the development of role rights management based on Core2.0

Source: Internet
Author: User

Directory of this document
1. Summary
2. Introduction to the framework
3. More information on Rights management
4. Summary

1. Summary

NCMVC role Rights Management Framework is the most recent practice of net core time to organize the system, the subsequent can not develop into a CMS also depends on whether friends have the need or time is full. Here Ncmvc mainly or to want to learn to contact the Friends of the ASP. NET Core2.0 to provide some reference and pit point reminders, the project now has a lot of shortcomings, will try to improve some of them. Writing this series is not exactly in accordance with the original list of the contents of the sequence to write, flashbacks/socialize are also the project practice to record down the way. There is a friend in the middle of the message said no source understanding is more troublesome, here I also do my best to send the source to git as soon as possible for everyone to download.

2. Introduction to the framework

The framework mainly includes: Database access and EF Core, logging, caching (Memcached/redis) are similar to the simple three-tier model under traditional WebForm, which facilitates understanding of hierarchical relationships. It is relatively easy to understand the initial learning of ASP. NET core, difficulty level: easy.

Nc.common "Tool Classes": Caching helper classes, configuration management classes, encryption and decryption, JSON processing, logging, and other tools collections

NC. Core Library: Database Operation Core Library, now mainly MSSQL operation

NC. Lib "General Class Library": mainly some global class libraries, such as: attribute class, Login authentication class, universal permission Authentication, configuration, exception handling, etc.

NC.Model"Efcore Database Model": DB first mode, Pit point: Before running the command, the project will be able to generate models, or the build fail is reported. ASP. NET Core 2.0 Project Combat (4) ADO Operations Database encapsulation, EF Core operations and examples

NC.MVC"MVC Main Program": Now only for background management, menu management, role Rights management, departmental user management, etc., Net core cookie and session mode is not the same, login need to rely on Microsoft.AspNetCore.Authentication. Website front-end members, the administrator with the project login please refer to the "ASP. NET Core 2.0 project Combat (10) based on the cookie login authorization authentication and realize the front-end members, backstage administrator at the same time login"; Now this mode of self-feeling is a bit cumbersome, if there are other simple ways to do so please leave a message to inform.

3. More information on Rights management

Now that the project is a rights management framework, then the permissions this block or to add some, in the "ASP 2.0 Project Combat (11) based on the OnActionExecuting Global filter, page operation permission filtering control to the button level" We have written about the implementation of the Authority management style of thinking, the following is a simple addition to the original article.

Now rights management is mainly for the menu and what permissions (button action) a control, the database to add a menu name an alias (Controller), alias as far as possible to match the menu link name, and tick the menu to check what permissions (Button).

After the menu is created, the program is controlled, the global controller adminbase is responsible for the authorization, all the background controll inherit adminbase, such as Ad_min/article/article_add address, Adminbase processing will find Article_add action to determine if the property, Navname and ActionType are included, If you include a menu alias (navname) and Action permissions (add button ActionType) that directly verify the permissions, this completes the general validation.

Based on a convention that is larger than the configured rules, we write the controller name directly when we create the menu, so that when the Navname and ActionType properties are not written, the controller+ conventions (ADD, Edit, Del, and so on) are validated, etc.

Summary: When the main idea, the agreement to verify the rights + attributes to verify the permissions and other authentication to achieve button-level permission control.

4. Summary

Just started to write the "ASP. NET Core Project" series from the list to the first article ASP. 1.1 At that time was also practiced, after all, immature. Write to now already net Core2.1, project cycle span is bigger, now more and more people join to net core open source ranks, after all net core is the trend, future use of people will certainly more and more. The project in real time to learn the fastest way of ASP. NET Core technology, I hope that we have a lot of open source, so as to improve the core ecosystem. There is no perfect program like no perfect person, I am still working hard; Welcome to recommend.

ASP. Net Core 2.0 Project Combat (2) Ncmvc a framework for the development of role rights management based on Core2.0

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.