security - Could I make dynamic render rely User Permissions in MVC 2? -
i make security system in mvc application. in mvc must done authorizeattribute , roles string via actions methods.
could make stuff: instead of action resolve want make view html parts hidden depend on current user permission set (for example: save button not visible if user not administrator).
within views, can conditional checks, such as:
<% if (user.isinrole("admin")) { %> <a href="#">an admin-only link</a> <% } %>
in partial views, user property not exposed, can still it:
<% var user = httpcontext.current.user; %> <% if (user.isinrole("admin")) { %> <a href="#">an admin-only link</a> <% } %>
Comments
Post a Comment