"Selfless sharing: from getting started to mastering ASP. NET MVC" starting with 0, building a framework, doing projects (7.1) module management, verifying permissions, displaying modules list

Source: Internet
Author: User

Statement: This series is original, share my present frame, without my consent, prohibit reprint! Http://yuangang.cnblogs.com

I hope that we all take steps to do, all the technology and projects, there is no reservation to provide, I hope we can do a set of their own, but also, please rest assured, as long as you like, someone needs, absolutely not rotten tail, I will persist in writing ~

If you feel the article is helpful, point a recommendation, let more friends to participate in, is also the encouragement of my labor results, thank you! Because still have to work, so basically are sacrifice lunch time to write blog, write blog is not simple CTRL + C, CTRL + V, I am to do it again, this is responsible for everyone, so sometimes update is not timely, or the problem is not timely answer, I hope you understand, thank you again!!

Because I quoted a lot of previously accumulated libraries, so some things are duplicated (later updated), some things are outdated, including the code I wrote, I hope you do not pure copy, take its essence to its dross >_<.

At the end of the project I will each part, each stage of the demo to download to everyone, in fact, if you finish, and eliminate my Code is not good place, you do not need these demo, is it ~

Index

"Selfless sharing: from getting started to mastering ASP. NET MVC" starting with 0, framing, doing projects (1) building an MVC environment registration area

"Selfless sharing: from getting started to mastering ASP. NET MVC" starting with 0, building a framework, doing projects (2) creating databases and data models

"Selfless sharing: from getting started to mastering ASP. NET MVC" starting with 0, framing and doing projects (3) Common basic data Operations class Repositorybase

"Selfless sharing: from getting started to mastering ASP. NET MVC" starting with 0, framing, doing projects (4) summarizing and summarizing some of the previous questions

"Selfless sharing: from getting started to mastering ASP. NET MVC" starting with 0, the framework, the Project (5.1) The implementation of the login function, began to touch the spring IOC, DI

"Selfless sharing: from getting started to mastering ASP. NET MVC" starting with 0, framing, doing projects (5.2) Implementation of login function, interface injection, log4net use

"Selfless sharing: from getting started to mastering ASP. NET MVC" starting with 0, building a framework, doing projects (5.3) Implementation of login functions, enriching data tables, establishing associations

"Selfless sharing: from getting started to mastering ASP. NET MVC" starting from 0, build a framework, do projects (5.4) The implementation of login function, create the interface and implementation class related to the login user

"Selfless sharing: from getting started to mastering ASP. NET MVC" starting from 0, together frame, do project (5.5) Login function implementation, improve the login function

"Selfless sharing: from getting started to mastering ASP. NET MVC" starting from 0, build a framework, do projects (6) Controller base class mainly do the login user, authorization authentication, log record and so on work

Briefly

Today, let's do a list of module management display modules

Project preparation

The tools we use are: VS + SQL Server + IIS7.5

I hope that we have a preliminary understanding of ASP. NET MVC, the theoretical things we do not do too much explanation, some places do not understand also does not matter, will use on the line, with more, with a long time, natural understanding.

Project start

First, add the preset data

The super Administrator is to get all the system and permissions, but first of all, there must be permissions, modules and permissions are the scaffolding of the entire system.

We first add several modules: module management and Rights management they all belong to system administration under the System Management Center

Sys_module

Sys_permission Add View Details (Detail) Add Delete (remove) permissions to the module table and the Permissions table, respectively

second, the new HomeController controller inherits Basecontroller
 Public class Homecontroller:basecontroller

(Basecontroller need to add reference using Webpage.controllers)

1. Injection Module Management

Add in Config/controllers.xml

(container needs to add reference using Service.iservice)

2, add the index view, the module (menu) Output to the page, you can use bootstrap background template +bui, see a person likes.

third, module management

1. New module Management controller Modulecontroller inherit Basecontroller

2, ibid, declaration container

3. Module Management Home View index add permission validation

4. Load Module List method Bindlist (outline, so we don't use paging here)

In order to display their hierarchical relationship more intuitively, we wrote a simple method of displaying the module name in the wrong layer.

5, we receive some parameters of the query, and then output the query results to the page (the receipt of the query keyword and the paging parameters used in the next page are received in Basecontroller we only receive the system ID here)

6. We add an action button on the Index view page

7. Query Search Items

8, receive list dynamic class, output list

four, in the program we have the operation of the module to verify the permissions, but, let the user click on an action button to prompt you do not have permission, this is very unfriendly, so, we think that the user has no operational rights to a module, we will remove this button

We have a permission set for the page in Basecontroller we receive this set merge in the layout page to deal with: no operational rights to this module we remove the

In this way, we do the front and back of the double authentication.

Show us the foreground effect (note: We did not add the Addchild permission when we added the test data) so the [add submodule] was removed from the column operation in the page.

Original article reproduced please respect the fruits of labor http://yuangang.cnblogs.com

"Selfless sharing: from getting started to mastering ASP. NET MVC" starting with 0, building a framework, doing projects (7.1) module management, verifying permissions, displaying modules list

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.