FluentSecurity:如何分配多个角色 [英] FluentSecurity: How to assign multiple roles
本文介绍了FluentSecurity:如何分配多个角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在ASP.NET MVC中,我们可以在AuthorizeAttribute中分配多个角色.我目前正在使用Fluent Security.该文档说RequireRolePolicy可以支持一个或多个角色.
In ASP.NET MVC, we can assign multiple roles in AuthorizeAttribute. I'm currently using Fluent Security. The documentation says RequireRolePolicy can support one or more roles.
我要执行以下代码:
configuration.For<MyController>(x => x.Index()).RequireRole("Administrator, Editor");
,但似乎只检查一个角色.如何为其分配多个角色?
but it seems that it only checks one role. How to assign multiple roles to it?
推荐答案
好,我现在知道了.
configuration.For<MyController>(x => x.Index()).RequireAllRolesPolicy("Administrator", "Editor");
这篇关于FluentSecurity:如何分配多个角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文