This project is read-only.

Trying to limit visibility of pages depending on role of user

Topics: Administration, Customizing Orchard
Aug 22, 2015 at 9:49 PM

Just getting started with Orchard - and it looks mighty impressive! But also a bit overwhelming at times...

Just watched the excellent "Orchard Fundamentals" Pluralsight course, and I now have a grasp on layer, widgets, zones etc. But that course was done in 2010, with Orchard 1.2 or 1.3 - now it's up to 1.9, and quite a few things look (and behave!) quite differently nowadays.

My task is: create a site that exposes some page (home page, a history page) to all visitor - anonymous or not - and a set of other pages only to authenticated users (members on the site).

How on earth do I do that?? I did find a way to create two separate menu widgets for the authenticated and anonymous users - so the menu is adapting to the situation OK - but if an anonymous user knows the URL, he can still navigate to a "restricted" page since I cannot seem to find a way to restrict a page to a given role ....

What am I missing? There must be a way to do this - no?
Aug 24, 2015 at 9:54 AM
There's a Content Permissions feature that you can enable. Once enabled, you can attach the ContentPermissions PArt to your Page content type, which enables you to configure permissions on a per-content item level by selecting which roles have read/modify access.
Aug 25, 2015 at 3:41 PM
Edited Aug 25, 2015 at 3:42 PM
As Sipke says there is a Content Permissions feature.

I actually ended up writing an entire step by step guide for this just last night on StackOverflow which should help you get started:
I'm not sure if that was you on there as well as you both mention the Pluralsight course but help that helps anyway :)
Aug 25, 2015 at 4:58 PM
Thanks, guys - I was missing the "attach the part to your page content type" step.

Works like a charm now.