Customizing Orchards back-end for certain sections

Topics: Administration, Customizing Orchard, Writing themes
Dec 5, 2011 at 10:28 AM

Hi there,

I am still fairly new to orchard and floundering around it. My site gives certain users access to a small section of the back-end, for controlling the events on my site. I have a user role with only this permission but they still see the orchard menu down the side with some of items on there that they can click on, and even though they cannot actually do anything there, I don't really want them clicking around and getting lost. Is it possible to assign a new theme to just one section (I assume it is done with themes..), or can I hide the dashboard menu at the side? I have a neat little method for extending my views across the dashboard menu but I would prefer to be able to completely hide the admin menu than just covering it up ^^ I hope you understand what I am trying to get at. I probably am missing something horribly simple here, I often do, so thanks for any feedback on it.

All the best

Coordinator
Dec 5, 2011 at 10:15 PM

The right thing to do is to not show those menu items. Are they from core modules or from gallery modules? If they are core, please file a bug in the issue tracker. If they are from the gallery, you'll have to modify their code.

Dec 5, 2011 at 10:44 PM
Edited Dec 5, 2011 at 10:44 PM

Menu items will hide depending on the user's permissions. But I've seen some examples in core where this isn't the case (a big one is the "New" menu and I think there's already a workitem for that somewhere).

Dec 6, 2011 at 10:28 AM

Ah I didn't realise that it was a bug, and yes it is that 'New' menu, and Content, the rest are custom modules I have written. Thanks for the prompt replies, and enjoying Orchard, a little daunting, but awesome all the same. Take care

Dec 6, 2011 at 12:17 PM

If you look at, e.g., Orchard.Users\AdminMenu.cs:

        public void GetNavigation(NavigationBuilder builder) {
            builder.AddImageSet("users")
                .Add(T("Users"), "11",
                    menu => menu.Action("Index", "Admin", new { area = "Orchard.Users" }).Permission(StandardPermissions.SiteOwner)
                        .Add(T("Users"), "1.0", item => item.Action("Index", "Admin", new { area = "Orchard.Users" })
                            .LocalNav().Permission(StandardPermissions.SiteOwner)));
        }

So that menu will only show with SiteOwner permission. Unfortunately, this isn't (yet) done for Core.Content.

Workitem is here: http://orchard.codeplex.com/workitem/17778

Patch will follow shortly ;)

Dec 6, 2011 at 2:12 PM

I've pushed a fix for this issue to my fork - http://orchard.codeplex.com/SourceControl/network/Forks/randompete/randompetefixes/changeset/changes/b8d952219b7a

Dec 6, 2011 at 4:10 PM

Ah cool, yeah because clicking on them error'd, which is kinda frustrating. I have decided to just create a route and when the page is rendered, check the route url and if it is the route my guest presenters have it hides the entire orchard navigation bar and stretches the content across it. Probably not the best way to do things but suits my purpose, and looks surprisingly good ^^ stops them clicking around orchards back-end at least.

I have another sort of off topic question that if anyone knows the answer to, it will be you guys: Is it possible to edit orchard content type fields? I don't seem to be able to, or am I missing something blindly simple?

Coordinator
Dec 9, 2011 at 2:55 AM

Sure, how are you trying and how is it failing?