Copied to clipboard

Flag this post as spam?

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


  • Bruce Castle 2 posts 22 karma points
    Aug 03, 2012 @ 17:51
    Bruce Castle
    0

    Razor Sitemap showing accessible pages only

    Task: Create a sitemap using razor that only shows the pages the current user is allowed to access.

    I have found and use the Razor Sitemap. I have studied many ASP.NET pages on System.Web.Security.

    Is there an Umbraco function like "IsAccessibleToUser( currentUser, pageNode )" (that is written about in MSDN for dotNET security)?

    related topic: (but the answer is in XSL)

    http://our.umbraco.org/forum/core/general/7103-Security-Trimming

    http://our.umbraco.org/forum/developers/extending-umbraco/5977-Sitemap-public-access

  • Jorge Lusar 150 posts 489 karma points
    Aug 03, 2012 @ 18:11
    Jorge Lusar
    0

    Hi Bruce,

    Based on XmlSitemap and the Razor DynamicNode Cheat Sheet, I guess you could do something like this:

    if(item.IsProtected())
    {
        return;
    }
    

    just below line 83 (look for if (!item.Visible) { return; }

    Cheers,

    J

  • Jorge Lusar 150 posts 489 karma points
    Aug 03, 2012 @ 18:16
    Jorge Lusar
    0

    I guess you could also use Cultiv Search Engine Sitemap and modify it as you need.

    J

  • Bruce Castle 2 posts 22 karma points
    Aug 03, 2012 @ 20:26
    Bruce Castle
    0

    item.HasAccess() showed if the current user has access to the item {page}.

    I wrapped the list item in an if(item.HasAccess()) { ... }

    I plan on posting the code after I clean it up.

     

    Thx,

    Bruce

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies