I would like to do this:
[RequiresAuthentication(CompanyType.Client)] public class FooController { public ActionResult OnlyClientUsersCanDoThis() public ActionResult OnlyClientUsersCanDoThisToo() [RequiresAuthentication] public ActionResult AnyTypeOfUserCanDoThis()
You can understand why this will not work. In the third step, the controller level filter blocks non-clients. Instead, I would like to "resolve" conflicting filters. I would like for a more specific filter (action filter) to always win. It seems natural and intuitive.
Once the filter filterContext set MethodInfo for the executing action. That would make it pretty easy. I thought about making some thought using the route information. This will not work, because the action may be overloaded, and I cannot determine which one is current.
An alternative is a scope filter at the controller level or action level, but without a mix, which will create a lot of additional attribute noise.
source share