Silly really - but I just can't seem to find my way around this just yet....
I installed the Orchard CMS in Azure - worked like a charm, added a few pages, played around, watched the Pluralsight "Orchard Fundamentals" course - seemed to make a lot of sense.
But now I'm stuck - I'm trying to create a public facing site, where some of the pages should be visible to any visitor including anonymous users, and some of course should be visible to only authenticated users.
OK, so I understand those are layers in play - default for everyone, authenticated for authenticated users - great. But how do I limit a given page which is present as Content in my dashboard so that it'll be displayed only on a given layer (e.g. only on the authenticated layer - not the default layer for everyone)
Seems like a simple task - but I just cannot seem to find the way to do it (nor does any of the docs or tutorial videos really help :-( )
Any takers?
Layers are only for widgets. In order to restrict access to a content item such as a page, what you need is content item permissions. That's a separate feature that is not enabled by default.
To enabled the Content Item Permissions module
In the admin panel go to
ModulesStart typing
permissionsinto thefilterbox at the top left hand corner of the tabs.The
Content Item Permissionsshould be shown in the list, clickEnablein the top right hand corner of its boxThis will reload the page and you should see a message at the top saying
Content Item Permissions was enabledEnabling this feature with your pages
Orchard CMS uses a concept where you can glue components together however you want them to be composed in order for them to support the features you want. The concept of a page is just a collection of parts like a page title, a url, text, setting a publish date and things like that.
By default simply enabling the module doesn't make any difference. You will need to add the feature to the Page content. To do this you just need to:
In the admin panel go to
Content DefinitionFind / filter the
Pagecontent type and clickEditon the right hand sideScroll down to
Partsand clickAdd PartsSearch for
Content Permissionsin the list, tick the checkbox and pressSaveat the bottom of the pageYou will be taken back to the
Pagecontent definition screen. At the bottom of thePartslist you will now see aContent Permissionsentry. If you want to set up defaults for new pages click the little>arrow to the left of the header and a panel will expand.If you want to add it to other content types such as blog posts then you can repeat this process and add it to any content type you want to.
Making an individual page password protected
Now that the feature is enabled and attached to your
Pagecontent type you can create a new private page by following these steps:In the admin panel click
New>Pagein the sidebarGive the page some basic content
Scroll down close to the end of the page and tick the checkbox labelled
Enable Content Item access controlLet's say you want to make it so anon uses cannot see the page. Under the
View this itemsection just tick all of the roles except forAnonymous(the second one in the list)Publish the page
Open up a new incognito / in-private browser tab (so the site thinks you aren't logged in) and visit the new page you just published.
You will be redirected to an error screen similar to this page: