简体   繁体   中英

How to order Roles hierarchy to access Authorized page in MVC5?

How to order Roles hierarchy to access Authorized page in MVC5 Project?

I have in MSSQL Database Roles table with multiple Roles, (Administrator, Moderator, Editor, Registered).

My question is how to access users with Administrator, Moderator or Editor if Controller access is

[CustomAuthorization(Roles = "Registered")]

Now i can access only with selected Roles for users.

Or i must add for everyone Roles like this?

[CustomAuthorization(Roles = "Administrator, Moderator, Editor, Registered")]

Any another Solution?

Yes, you are right. There is good artice for this in docs.microsoft.com

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