Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rob Watkins 369 posts 701 karma points
    Jul 24, 2012 @ 18:16
    Rob Watkins
    0

    Public access - protecting the home page

    I have a site that needs to have role based protected set right from the home page; I tried set it up using standard practice, everything under the home page:

    Content
    -- Home
      -- Page1
      -- ... 
      -- Login
      -- Not Permitted

    However, I can't now secure it because if I secure the Home Page, the login page is secured, and there doesn't seem to be any way of allowing anonymous access on a subnode of a protected node.

    Tried adding the rule manually to the web.config but no joy.

    Is there any way of doing this, or do I need to move Login directly under the Content node?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jul 25, 2012 @ 09:48
    Jeroen Breuer
    0

    I think that you need to move the Login page under the Content node (or at least not under a node that is protected).

    Jeroen

  • Rob Watkins 369 posts 701 karma points
    Jul 25, 2012 @ 10:08
    Rob Watkins
    0

    Okay, suspected as much, thanks Jeroen. This would be a very handy feature for a later release though :o)

  • Rob Watkins 369 posts 701 karma points
    Jul 25, 2012 @ 10:50
    Rob Watkins
    0

    How the hell do I get the Content Node in Razor?!

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jul 25, 2012 @ 10:53
    Jeroen Breuer
    0

    Why do you want to get the content node in Razor? It's not an actuall node (although it has id -1 in the db), but more of a placeholder in the tree under which you can create real nodes.

    Jeroen

  • Rob Watkins 369 posts 701 karma points
    Jul 25, 2012 @ 11:03
    Rob Watkins
    0

    Hmmm, actually, I don't need to for this instance. I was thinking that I needed to have a macro that got content nodes for a menu that worked in the login page and the home page, but as everything will be secured anyway, I don't actually need that.

    However, it'd be handy to know for future reference, given a content tree like this:

    Content
    - Home
    - - Page 1
    - - Page 2
    - - Page 3
    - Login

    How would I write a macro that gets all Page document types that can run in both Login and content within Home, and without passing the ID and ideally not the document type of the Home node itself in so the code can be easily reused?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jul 25, 2012 @ 11:21
    Jeroen Breuer
    1

    What I always do is create a topnode even if you don't need it. So the structure would look like this:

    Content
    - TopNode
    - - Home
    - - - Page 1
    - - - Page 2
    - - - Page 3
    - - Login

    Because topnode is a real node you can fetch it and get it's children.

    If you do this it's good to have umbracoHideTopLevelNodeFromPath in the web.config set to true.

    Jeroen

  • Rob Watkins 369 posts 701 karma points
    Jul 25, 2012 @ 11:23
    Rob Watkins
    0

    Oh, that's a neat solution, thanks!

  • Douglas Ludlow 210 posts 366 karma points
    Jul 25, 2012 @ 14:54
    Douglas Ludlow
    0

    By the by, to access the root (or Content) node in razor, you just get the node by Id (-1).

    var root = Library.NodeById(-1);
Please Sign in or register to post replies

Write your reply to:

Draft