This project is read-only.

Hide Local menu "Content Type" and "Content Parts" When Role has not the permission to Edit them

Topics: Administration
Nov 23, 2012 at 3:31 PM

in Orchard.ContentTypes\AdminMenu.cs I wanted to hide Content Types And Content Parts LocaNav menu for missing ContentTypes.Permissions.EditContentTypes Roles : So I modified the code like so:

using Orchard.Localization;
using Orchard.UI.Navigation;

namespace Orchard.ContentTypes {
    public class AdminMenu : INavigationProvider {

        public Localizer T { get; set; }
        public string MenuName { get { return "admin"; } }

        public void GetNavigation(NavigationBuilder builder)
                        menu => menu
                                    .Add(T("Content Types"), "3", item => item.Action("Index", "Admin", new {area = "Orchard.ContentTypes"}).LocalNav().Permission(ContentTypes.Permissions.EditContentTypes))
                                    .Add(T("Content Parts"), "4", item => item.Action("ListParts", "Admin", new { area = "Orchard.ContentTypes" }).LocalNav().Permission(ContentTypes.Permissions.EditContentTypes)));


Should this beahaviour be integrated in next release of Orchard? If yes, who can integrate this code? if not, how to change this core functionality? making a module?

Thanks for reply.

Nov 26, 2012 at 10:04 PM

Yes, please file a bug if there isn't one already and make a pull request. Thanks.

Dec 12, 2012 at 7:50 PM

Submitted a bug, created a fork, made a pull request.