[daisy] Changing the access denied page for guest
Parisi, Lou
Lou.Parisi at photomask.com
Wed Feb 13 15:06:44 CST 2008
This message from 2005 has information about changing the access denied
page message for the guest or logged in user.
http://lists.cocoondev.org/pipermail/daisy/2005-October/002399.html
I found that the reference in the old message
<xsl:when test="exceptionChain/throwable[1]/@class =
'org.outerj.daisy.repository.DocumentReadDeniedException' and
$httpMethod = 'GET'">
is no longer accurate. In my daisy version 2.1 the installed file has
throwable[2] but this does not work. Through trial and error I found
throwable[3] gave me the ReadDeniedException class.
I updated this and changed error.xsl to give one message for the guest
role and another for any other role like this:
<xsl:variable name="onlyGuestRole"
select="boolean($user/activeRoles/role[@name='guest']) and
count($user/activeRoles/role) = 1"/>
<xsl:choose>
<!-- special treatment for accessexceptions: let user change login
and return to original page. -->
<xsl:when test="exceptionChain/throwable[3]/@class =
'org.outerj.daisy.repository.DocumentReadDeniedException' and
$httpMethod = 'GET'">
<xsl:value-of select="exceptionChain/throwable[3]/@message"/>
<xsl:choose>
<xsl:when test="$onlyGuestRole">
<p>
<xsl:text>Guest role does not have access to view
project pages. Please login.</xsl:text>
</p>
<p>
<a
href="{$mountPoint}/login?returnTo={urlencoder:encode($pageURI,
'UTF-8')}"><i18n:text key="error.change-login"/></a>
</p>
</xsl:when>
<xsl:otherwise>
<p>
<i18n:translate>
<i18n:text key="error.login-info"/>
<i18n:param><xsl:value-of
select="$user/name"/></i18n:param>
<i18n:param>
<xsl:call-template name="roleList">
<xsl:with-param name="roles"
select="$user/activeRoles"/>
</xsl:call-template>
</i18n:param>
</i18n:translate>
</p>
</xsl:otherwise>
</xsl:choose>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cocoondev.org/pipermail/daisy/attachments/20080213/7f466e92/attachment.htm
More information about the daisy
mailing list