This project is read-only.

Allow Anonymous Navigation Menu Display without View All Content in Roles

Topics: Core
Oct 14, 2012 at 10:48 PM


I have a problem that I am likely misunderstanding. I have content on my website that I want to not be visible to anonymous users. So, I go to the anonymous role and uncheck the "View All Content".  I then go and check the content I want the user to be able to view. This all works great for the content pages themselves but the navigation menu, for "Content Menu Item" will not show any of the pages the user is ALLOWED to see, in fact, it won't show any menus that are of type "Content Menu Item".

I dug into the code for about an hour to realize that it seems to only allow the viewing of these menu items when "View All Content" is checked (in the code it is "ViewContent").  Does this mean I cannot use "Content Menu Item" type of navigation menu and have to utilize all "Custom Link" to accomplish the type of scenario I am looking for? I thought that the "Content Menu Item" would evaluate the content item it links to to determine if the user has access though this does not seem to be the case. I could not find a bug in the "Issue Tracker" but if someone knows of or has advice on what I can do I would appreciate it.

Oct 14, 2012 at 10:54 PM

Adding more to it, even using a "Custom Link" does not work, it must evaluate down to the content item to check for permissions. So, now I am really stuck as to why the navigation menu thinks I (as an anonymous user) cannot access a page when I can directly type the url in and it allows access to the content. Hopefully someone can give me a clue (or a hack :) ).

Oct 22, 2012 at 1:58 PM

I have attempted this on a brand new install of 1.6RC to see if this was something that was an issue with my current version and the problem remains.  Actually, it seems that much of the problem has been fixed - thanks Orchard Developers.

The only one item that is still a problem are Blogs / Blog Posts. Since there are no permissions that can be set to actually allow access to this Content Type.  I do have a solution though, if you go to the Blog Content Type and change it to "Creatable" that opens it up to be controlled by the "Roles" and you can then get permissions to allow anonymous users to view it.  Unfortunately, it also opens it up to other navigation menus to create (a small price to pay to be able to control the content of the website).

Does anyone else have a recommendation that could be done on Blog / Blog Post?  The only thing I can conclude is explicitly adding the permission into the core module.

May 3, 2013 at 12:16 AM
I just wanted to note in case anyone else runs into this similar problem because jao28's solution works for it too:

In 1.6, if you take away "View all Content" from a role, some of the menu types will be hidden from that role and they won't appear in the Users -> Role permissions page. For example, Custom Link items vanish, but if you mark the Custom Link type Createable, you can go into the role permissions and find a new Custom Links section, and assign "View by Others".

So it looks like this is a good generic solution to types that do not exhibit role permissions by default? Or at least in these cases :)