I started using the default project AccountController , but I expanded it / changed it beyond recognition. However, as in the original, I have a LogOn and LogOff .
Obviously, the LogOn action should be available to everyone. However, since I added many other actions to this controller (for creating and editing users), I want 99% of the actions to require membership in the administrator role.
I could decorate all my actions [Authorize Roles="Administrators"] , but there is a risk that I will forget it. I would prefer to make it safe by default by decorating the controller class itself with this attribute, and then canceling the requirement in my LogOn method. Can I do it?
(As in, can I do this out of the box without creating custom classes, etc. I donโt want to complicate things more than necessary.)
authorization asp.net-mvc
Gary McGill Mar 29 '10 at 10:52 2010-03-29 10:52
source share