简体   繁体   中英

Adding Role Property to the existing MVC 5 web app

I have created a project based on the sample posted on the official ASP.NET site: MVC 5 with 2FA, email confirmation, password reset SMS,Two-Factor Authentication . On the other hand, although there is a separate table for Roles, I have no idea how to integrate such a kind of control which meet best my requirements. I just want to create some roles and assign them to the users. After a user login to the system, I want to check his roles and let them to reach the enabled actions for this role. How can I make such a kind of integration?

您可以使用Authorize属性来指定允许访问控制器或操作的角色。

[Authorize(Roles="user, admin, another")]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM