My controller is using an attribute at class level which allows only one role to access. This controller has more than 20 actions. But for only one action I need one more role to get access. I have declared the attribute filter at class level so that it is working fine for all the actions within the controller class. But now I want to override this one for only one action within the same controller. Is there any possibility for that? I'm using .Net version 4.5.
Filter attribute implementation goes like this:
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public class RequireModulePermissionAttribute : AuthorizeAttribute
{
//code goes here
}
Controller class:
[RequireModulePermission("Admin")]
public class AdministrationController : Controller
{
[HttpPost]
[RequireModulePermission("Admin","Supervisor")]
public ActionResult CreateUser(UserViewModel userVM)
{
//code goes here
}
}