This project is read-only.

Filtering out Menu Items by permission

Topics: Customizing Orchard, Writing modules
Apr 16, 2013 at 12:30 AM
I've added a field to a menu item that will allow me to add a permission using the technique similar to: Customizing Menu Item - Adding Css Class although I've done it programatically by adding a content part and attaching it to MenuItem.

I am now wondering the best place or best approach to filter out the menu items so that they are only rendered if the user has the appropriate permission. I used to use the Szmyd Advanced menu for this, but I am trying to upgrade my project to Orchard 1.6 and move away from the Szmyd menu and leverage only the built in Orchard menu.

I now have a field called RequiresPermission attached to all my Orchard MenuItems and they all have valid permissions attached to them. I'm not sure if I can do something to filter the items out before they get processed by the menu items driver or if i have to possibly pass something to my MenuItem.cshtml and do the filtering in the view (which would be less than ideal)

any ideas on where to focus my effort?
Apr 16, 2013 at 2:45 AM
U can try the ContentPermission ?