I’m looking for an ideal way for my input forms to either show as a textbox (editable), label (readonly), or hidden (no access) based on the roles. I know I could have a different view for each type of role but I was hoping that there’s some new goodness out there that would prevent me from having to do 80 views.
Share
Really it all depends on where you want to set your security related meta data. What do you want to to do? Decorate your view models with attributes? Use Dynamic Data meta buddy classes? Fluent configuration ala StructureMap/FluentNhibernate?
One way to do it using MVC Preview 2 or the InputBuilder project from lostechies.com and attribute decorations is to override UIHint and supply your own UIHint values back to template builders:
So your view model:
So now when the code goes to grab the partials for you it knows whether to display it in an input tag or just a lable or placeholder.