Reputation: 41
I have a graphic panel that appears on the right side of every page of my Umbraco4 website. I want the panel to only appear if the logged-in user has access to the page it links to. If not, I’d like the panel to disappear.
The panel appears correctly but it is not disappearing when the user has no access to the page. As a result, user sees a "you have no permission to access this page" text page once they have clicked on the link.
What can I add to the code below so it is permission-enabled? Note that I’m also open to having this converted to Razor.
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<xsl:variable name="documentTypeAlias" select="string('HomePage')"/>
<xsl:template match="/">
<xsl:for-each select="$currentPage/ancestor-or-self::root//* [name() = $documentTypeAlias and string(umbracoNaviHide) != '1' and (umbraco.library:IsProtected(@id, @path) = false() or umbraco.library:HasAccess(@id, @path) = true())]">
<xsl:if test="./editorsManualLink != ''">
<a href="{umbraco.library:NiceUrl(./editorsManualLink)}" target="_self" class="editorsManual" title="Visit the Editor’s manual">
<h3>Editor’s manual</h3>
</a>
</xsl:if>
</xsl:for-each>
</xsl:template>
Upvotes: 1
Views: 29