Copied to clipboard

Flag this post as spam?

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


  • Greg F 2 posts 22 karma points
    Dec 02, 2009 @ 18:21
    Greg F
    0

    List of protected page logged-in user has access to?

    Hello,

    I am trying to list out every protected page that the current logged-in user has access to from the root down.  I used the "list pages by level" XSLT as a base, and modified it slightly to include a check for "page is protected" and "user has access", but I don't get any pages, and I'm not sure why (XSLT isn't my strong point... it looks ok to me!).

    This is what I've got so far:

    <?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" />

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="/descendant::node [(umbraco.library:IsProtected(@id, @path) = true() and umbraco.library:HasAccess(@id, @path) = true())]">
        <li>
            <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:value-of select="@nodeName"/>
            </a>
        </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

    </xsl:stylesheet>

    Anyone got any ideas?

    Thanks,
    Greg

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Dec 02, 2009 @ 19:04
    Chriztian Steinmeier
    0

    Hi Greg,

    You need to start from the currentPage parameter to select nodes in Umbraco:

    <xsl:for-each select="$currentPage/ancestor-or-self::root/descendant::node [(umbraco.library:IsProtected(@id, @path) = true() and umbraco.library:HasAccess(@id, @path) = true())]">

    That ought to do it.

    /Chriztian

  • Greg F 2 posts 22 karma points
    Dec 02, 2009 @ 19:40
    Greg F
    0

    Ah thank you, yes that fixed it!

     

    Regards,
    Greg.

Please Sign in or register to post replies

Write your reply to:

Draft