I'm trying to implement Roles permissioning within my controller:
[PerfilFiltro(Roles = "Administrador,Caixa")]
public ActionResult Index()
{
return View(db.Adicional.ToList());
}
public class PerfilFiltro : AuthorizeAttribute
{
public override void OnAuthorization(AuthorizationContext filterContext)
{
base.OnAuthorization(filterContext);
if (filterContext.Result is HttpUnauthorizedResult)
filterContext.HttpContext.Response.Redirect("/Home/Negado");
}
}
I want to do as follows:
What happens when I put between commas is that the role of the logged-in user must be admin AND box, but I want to OR admin OR box.