【发布时间】:2013-06-20 18:42:40
【问题描述】:
我在为类方法指定两个单独的授权属性时遇到问题:如果两个属性中的任何一个为真,则允许用户访问。
Athorization 类如下所示:
[AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
public class AuthAttribute : AuthorizeAttribute {
. . .
和行动:
[Auth(Roles = AuthRole.SuperAdministrator)]
[Auth(Roles = AuthRole.Administrator, Module = ModuleID.SomeModule)]
public ActionResult Index() {
return View(GetIndexViewModel());
}
有没有办法解决这个问题,还是我需要重新考虑我的方法?
这将在 MVC2 中运行。
【问题讨论】:
标签: c# asp.net-mvc asp.net-core