I searched everything for elegant solutions to this not so long-standing issue. How to block form elements in ASP.Net MVC View without adding if ... then it is logical everywhere?
Ideally, BaseController, whether OnAuthorization, or OnResultExecultion, will check the rendering form elements and hide / not display them based on the role and scope.
Another approach that I examined is to write some kind of custom attributes to stay up to date on how we block ActionResults using [Authorize]. Is it possible even without passing the list of hidden objects to the view and putting all this?
Other background information: we will have a database that tells us at runtime (based on the user's role / area) which elements will be hidden. We are using MVC3 with Razor Viewengine. We use BaseController, where any of the Controller methods can be overridden.
Any help on this would be greatly appreciated!
Zacho
source share