答案 0 :(得分:0)
你可以使用PrincipalPermission
这里是示例如何实现。所有用户(UserB,UserA,Admin
)都可以访问此方法)
[PrincipalPermission(SecurityAction.Demand, Role = "UserB")]
[PrincipalPermission(SecurityAction.Demand, Role = "Admin")]
[PrincipalPermission(SecurityAction.Demand, Role = "UserA")]
public bool Add(Item item)
{
}