I am developing a website in MVC4. I developed user roles and permissions.
I want to ask where I should check user permission access: in the Custom Action filter, or the Custom Authorization filter?
If user does not have access to the module, then I must show a toaster error message. How do I show this message in an action filter?
I use to write custom action filter attribute so that on the action call this method is called and i check in it if user role allows him to call this action or not.
You have to write custom action filter attribute same way but you have to write your own business logic in CheckAccessRight method:
And then use this attribute on the actions like this:
Here's a good article. You can set your own attributes for several roles like admin.