I have an ASP.NET website for which I want to filter content based upon user Roles.
Say, for a "Manager" certain section displays and for an "Operations" guy, some other section is visible.
I don't want to use those If-else blocks
in my UI throughout.
Is there any design guideline for separating my role based logic with my interface so that the controls automatically know when to be visible and when not?
I am familiar with the sitemap based restrictions.
I am looking for some best practices followed for this problem.
Asked
Active
Viewed 47 times
0
1 Answers
0
For web forms you could use multi views which display a certain view depending on the role.
For MVC you could use child actions. Happy to provide more info if you require it.

timothyclifford
- 6,799
- 7
- 57
- 85
-
Do you mean using partial views for different roles? – Atishay Jun 07 '13 at 13:13
-
Partials would still require you to use conditionals in your view logic. So are you using MVC or WebForms? – timothyclifford Jun 07 '13 at 13:25
-
Well then I'd suggest Sitemap trimming as you mentioned OR handle the authentication in your controller method then full users to different actions based on their role. – timothyclifford Jun 19 '13 at 05:41