Authenticated Section

Topics: Administration, Customizing Orchard, General
Apr 19, 2011 at 9:48 PM

How would I go about setting a page to require authentication in order to access it? I have a sections of videos that I only want logged in users to see. Thanks

Apr 20, 2011 at 3:24 AM
jseiwert wrote:

How would I go about setting a page to require authentication in order to access it? I have a sections of videos that I only want logged in users to see. Thanks


I have the exact same issue. Please see: http://orchard.codeplex.com/discussions/242714

Apr 20, 2011 at 1:45 PM

It occurred to me that you could hard-code an IAuthorizationFilter to require authentication on certain paths. Not a very flexible solution but it could be a "quick fix" if you desperate need this.

Apr 20, 2011 at 3:51 PM
Edited Apr 20, 2011 at 3:57 PM
jseiwert wrote:

How would I go about setting a page to require authentication in order to access it? I have a sections of videos that I only want logged in users to see. Thanks

 

Firstly it's Biergarten season, the sun has been shining all day and sitting under a chestnut tree drinking a couple of Maß of Bavaria's finest brew won hands down over sitting in front of a monitor.

Secondly, this is all from my current post Biergarten memory, I don't actually like how I achieved what you are trying to accomplish, there is probably a better solution ( I saw it as a cheap fix) but it did work as far as I could see.

So the scenario were that I was looking to have an 'employees area' on a site whilst I were doing some trials to see what Orchard would let me do. I ended up creating a role "Employee" and a layer called "EmployeeHome".
I downloaded from the gallery a module that lets you apply layer rules based on Tags. Then in the layer I added a rule -----> role ("Employee") and tagged "EmployeeHome". Then when creating a page for employees only,
I added the Tag " EmployeeHome " to it and added whatever I required into the zones.

Also for good measure I added a layer called "NotEmployee" and set the Layer Rule to --> role not ("Employee") and tagged "EmployeeHome" and in that layer had a "You are not authorized blah blah blah" message.

 

Like I said it's not pretty and I don't particularly like it (or dig into it too deeply) , but as far as I could see it worked. Also I didn't dig too deep into this but there were also a module for basing layer rules on content types

which could mean that you could create a content type "EmployeePage" for example, that just had the exact same functionality as a normal page and base your layer rule on that and avoid the 'ugly' added tags solution.

 

Forgetting all that I posted above, but haven't I read somewhere that you can base authorization via roles and the url?

 

Anyway, I'm off back to the Biergarten :D I only came home as I forgot my wallet and had ran out of cash :-(

 

PROST!!!

Nick

 

 

EDIT: role not ("Employee") and tagged "EmployeeHome"  <----- just realised this is probably poop with the not ("Employee")  rule, but you get my drift.