Copied to clipboard

Flag this post as spam?

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


  • Graeme W 113 posts 289 karma points
    Jan 10, 2014 @ 19:08
    Graeme W
    0

    Indicating links to restricted pages

    Is there any way to indicate that navigation links lead to restricted page so that users will know before they click on them? Was thinking of either greying them out or possibly a little padlock beside them.

    This could be either - if current user doesn't have access, or - if the page has any public access restrictions at all

    I'm using version 6 in MVC mode

    Thanks

  • Kevin Jump 2312 posts 14698 karma points MVP 7x c-trib
    Jan 11, 2014 @ 19:13
    Kevin Jump
    100

    Hi

    when working with links you can check use HasAccess

    @foreach(var item in Model.Children)
    {
        if(item.HasAccess())
        {
            @item.Name 
        }
    }
    

    this tells you if the current user has access to a node.

    .IsProtected() tells you if the node has permissions set.

  • Graeme W 113 posts 289 karma points
    Jan 13, 2014 @ 11:57
    Graeme W
    0

    Thanks - just what I needed to know

  • Graeme W 113 posts 289 karma points
    Jan 21, 2014 @ 13:11
    Graeme W
    0

    Actually I couldn't use the item.HasAccess method mentioned above as I got a message saying it wasn't available to my model type - IPublishedContent

    I've got round it by using the following helper thingy...

    @if(Umbraco.MemberHasAccess(node.Id, node.Path)){ // link here } else { // do nothing or muted text, or padlock - not sure yet }

Please Sign in or register to post replies

Write your reply to:

Draft