Copied to clipboard

Flag this post as spam?

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


  • syn-rg 282 posts 425 karma points
    Mar 22, 2010 @ 07:31
    syn-rg
    0

    Hide links from user types

    I want to hide pages from user types. I'm using "Role based access protection" on a section I do not want visible to certain user types. However, the link still appears visible to all users. I want this link only visible to certain user types. How can I do this?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Mar 22, 2010 @ 08:49
    Dirk De Grave
    0

    JV,

    May have a look at this wiki entry...

     

    Hope this helps.

    Regards,

    /Dirk

  • syn-rg 282 posts 425 karma points
    Mar 23, 2010 @ 01:27
    syn-rg
    0

    Thanks Dirk,

    I added this to my 3 levels of navigation, and it works perfectly. Which is of great relief.

    However, I have created a "print this page" macro that allows users the print the current page, the parent above and the parent above that. Which means I have to figure out a way to block users from printing the "hidden" pages.

    Does anyone have some advice?

    Thanks,
    JV

  • Lee Kelleher 4026 posts 15837 karma points MVP 13x admin c-trib
    Mar 23, 2010 @ 01:29
    Lee Kelleher
    0

    Can't you use the HasAccess check in your "print this page" macro?

  • syn-rg 282 posts 425 karma points
    Mar 23, 2010 @ 01:49
    syn-rg
    0

    Hi Lee,

    Currently I've added it in, but not sure if this is correct:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="msxml umbraco.library">


    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <!--

    Current Page's parent, sibling with families
    Current page and all children
    Current page Only

    -->
    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <!-- Parent and sibling families -->

    <xsl:for-each select="$currentPage/parent/node [string(data [@alias='umbracoNaviHide']) != '1' and (umbraco.library:IsProtected(@id, @path) = false() or umbraco.library:HasAccess(@id, @path) = true())]">
    <div id="print">
    <p>
    <a>
    <xsl:attribute name="href">/PrintPages.aspx?nodeid=<xsl:value-of select="@id"/></xsl:attribute>
    <xsl:value-of select="@nodeName"/>
    </a>(<xsl:value-of select="count(child::node) + 1" />)
    </p>
    </div>
    </xsl:for-each>

    <xsl:call-template name="printPage">
    <xsl:with-param name="nodeName" select="$currentPage/parent::node/@nodeName"/>
    <xsl:with-param name="nodeId" select="$currentPage/@id"/>
    <xsl:with-param name="type" select="3"/>
    <xsl:with-param name="pageCount" select="count($currentPage/parent::node/descendant-or-self::node/node) + 1"/>
    </xsl:call-template>

    <!-- Current Page All Children -->
    <xsl:call-template name="printPage">
    <xsl:with-param name="nodeName" select="$currentPage/@nodeName"/>
    <xsl:with-param name="nodeId" select="$currentPage/@id"/>
    <xsl:with-param name="type" select="2"/>
    <xsl:with-param name="pageCount" select="count($currentPage/node) + 1"/>
    </xsl:call-template>

    <!-- Current Page Only -->
    <xsl:call-template name="printPage">
    <xsl:with-param name="nodeName" select="'CurrentPage'"/>
    <xsl:with-param name="nodeId" select="$currentPage/@id"/>
    <xsl:with-param name="type" select="1"/>
    <xsl:with-param name="pageCount" select="1"/>
    </xsl:call-template>


    </xsl:template>

    <xsl:template name="printPage">
    <xsl:param name="nodeName"/>
    <xsl:param name="nodeId"/>
    <xsl:param name="type"/>
    <xsl:param name="pageCount"/>
    <div id="print">
    <p>
    <a>
    <xsl:attribute name="href">/PrintPages.aspx?nodeid=<xsl:value-of select="$nodeId"/>&amp;type=<xsl:value-of select="$type"/></xsl:attribute>
    <xsl:value-of select="$nodeName"/>
    </a>(<xsl:value-of select="$pageCount" />)
    </p>
    </div>

    </xsl:template>

    </xsl:stylesheet>
  • Stephan Lonntorp 195 posts 212 karma points
    Mar 23, 2010 @ 07:51
    Stephan Lonntorp
    0

    JV, although this has nothing to do with your problem, you might want to consider rendering an alternate template for your page, instead of adding the node-id to the querystring, the path would look something like this: /path/to/my/page/alternate-template.aspx

  • Lee Kelleher 4026 posts 15837 karma points MVP 13x admin c-trib
    Mar 23, 2010 @ 10:53
    Lee Kelleher
    0

    Hi JV,  I'd say you'd need to add the IsProtected and HasAccess checks to the "printPage" template too.

    I'd agree with Stephan's suggestion.  I use an alternative template (altTemplate) for my print pages. Read more about altTemplate here.

    http://www.nibble.be/?p=42

    Cheers, Lee.

  • 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