Copied to clipboard

Flag this post as spam?

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


  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    May 31, 2013 @ 14:47
    Jeroen Breuer
    0

    IPublishedContent and HasAccess/IsProtected

    Hello,

    I'm building a sitemap with IPublishedContent. With DynamicNode you could dot something like this in Razor:

    foreach (var node in startNode.Children
        .Where("HasAccess")
        .Where("!IsProtected")
        )
    {

    I see that the UmbracoHelper has IsProtected and MemberHasAccess, but they need a path property and with DynamicNode you don't need that. What path should I use there because I'm just trying to create a sitemap where protected pages are excluded.

    Jeroen

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    May 31, 2013 @ 16:08
    Jeavon Leopold
    0

    Hi Jeroen,

    Very interesting, looks like you just use it like Umbraco.IsProtected(node.Id, node.Url);

    It seems the path parameter could be a CSV of NodeIds, but I can't understand quite why it needs both parameters.

    In DynamicNode, the IsProtected methods calls umbraco.library.IsProtected(n.Id, n.Path) which now calls GetUmbracoHelper().IsProtected(DocumentId, Path), so it's actually just also now calling the UmbracoHelper.

    Hope that's helpful?

    Jeavon

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    May 31, 2013 @ 17:32
    Jeavon Leopold
    101

    Ah, I see, it should be @Umbraco.IsProtected(node.Id, node.Path)

Please Sign in or register to post replies

Write your reply to:

Draft