I have an ASP.NET MVC4 site with custom user/role provider. Entity Framework works with the user and role entities at the bottom level. Now I am introducing a concept of RolePermissions. Each role has an asscocialted list of permissions that allow users in this role to perform certain actions within the system, like deleting comments for example.
In my custom-build admin panel I want to list all the actions of a controllers and have an ability to allow or disallow the call to some action based on the presenace of a permission in the curent user's role.
Questions are:
- Is it possible?
- How do I list a set of actions in the controller.
- How do I assign or cancel an association between action and a role permission.
Possible starategy:
I introduce a global custom filter that is applied to all of the controllers and actions, that checks my database to see If I have a logical association. This way a checking code is ran every time the user makes a call to an action. Still how do I list controllers and actions (via reflection perhaps?)