简体   繁体   English

基于ASP.NET MVC用户的控制器操作特权

[英]ASP.NET MVC User based Privileges for Controller Actions

I have application where I want to grant or prohibited the roles to access the Controller. 我在要授予或禁止角色访问Controller的位置有应用程序。

Admin can change the the privilege of roles in roles management. 管理员可以更改角色管理中角色的特权。

below is pic of role management where admin can change the privilege 下面是角色管理的图片,管理员可以在其中更改特权

How to apply Authorization on Controllers based on these dynamically changing privileges. 如何基于这些动态更改的特权在控制器上应用授权。

I think this is exactly what you need. 我认为正是您所需要的。 You can create custom policies, in your case a policy per controller where you get the roles from the database in your custom policy. 您可以创建自定义策略,在这种情况下,可以创建每个控制器的策略,您可以在其中从自定义策略的数据库中获取角色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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