what is advantage of create role dynamically in asp.net mvc

I have a question that really confused me! I've read ASP.NET MVC 5 Identity: Implementing Group-Based Permissions Management Part I and this article ASP.NET MVC 5 Identity: Implementing Group-Based Permissions Management Part II that describes how to create roles dynamically and assign each of them to groups and each user assign to groups.

but I must hard code Authorize attribute above of each Action yet! so, what is advantage of create roles dynamically?


It depends , you can create your own authorize filter and make everything configurable and no need to hard code any of the data. Now with the ASP.NET MVC 5 you can add the attribute and the Global level , and we have controller level and action level for from long time.You can google and get a lot of example of creating custom authorization see here for one of the example

http://www.dotnet-tricks.com/Tutorial/mvc/G54G220114-Custom-Authentication-and-Authorization-in-ASP.NET-MVC.html

链接地址: http://www.djcxy.com/p/90166.html

上一篇: asp.net mvc可配置权限系统

下一篇: 在asp.net mvc中动态创建角色的好处是什么?