Example on how to include Roles to Controller

Apr 16, 2009 at 3:44 AM
Thank you very much for providing such a nice way to implement SiteMap.

This is fairly new to me, I have created my own User Controller to implement logon security. I would like to have each controller based on a specific Role/Roles. By using MVCSiteMap, is it possible to decoratively set that per Controller?

Thank you very much for your time.

Apr 17, 2009 at 9:16 AM
You would like to see something like [AuthorizeSiteMap], for example?
Apr 17, 2009 at 3:34 PM
Functionally I have multiple roles within the system. For example
Role = "Employee"
Role = "Customer"
Role = "Administrator"
Role = "All"

User can have one or more roles. After user logged in, only menus to be displayed that user have access to.

Additionally when user clicks on the menu, controller to make sure that user is authorized to access the controller.

Is it possible to do above functionality using MVCSiteMap?
Apr 18, 2009 at 9:24 AM
You can simply set [Authorize(Roles = "Allowed role for action method")] on your action method. MvcSiteMap will take this into account when displaying data.