Copied to clipboard

Flag this post as spam?

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


  • Henrik Hammarström 58 posts 54 karma points
    Oct 18, 2009 @ 20:48
    Henrik Hammarström
    0

    HasAcess ?

    Hi

     

    isnt it possible to like this .....

    I want to check if a user hasaccess to a page

     

    <xsl:if test="umbraco.library:IsProtected(@id, @path) = false() or umbraco.library:HasAccess(@id, @path) = true()>
    <xsl:value-of select="data [@alias = 'Text_AF']"/>
    </xsl:if>

     

     

    I get this error

     

    Error occured

    System.OverflowException: Value was either too large or too small for an Int32.
    at System.Convert.ToInt32(Double value)
    at System.Double.System.IConvertible.ToInt32(IFormatProvider provider)
    at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
    at System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType)
    at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
    at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
    at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)
    at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
    at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, TextWriter results)
    at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
    at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)

     

     

     

     

    Best
    /H


  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Oct 18, 2009 @ 20:54
    Sebastiaan Janssen
    2

    Make sure to surround your XSLT with a test to see if the id is empty:

    <xsl:if test="@id != ''">
     ...
    </xsl:if>
  • Henrik Hammarström 58 posts 54 karma points
    Oct 19, 2009 @ 20:40
    Henrik Hammarström
    0

    Hi again

     

    The problem is now that when I do like thisin my macro I get no valiue in @id

     

    <xsl:if test="@id != ''">
    <xsl:if test="(umbraco.library:IsProtected(@id, @path) = false() or umbraco.library:HasAccess(@id, @path) = true())">">
    <xsl:value-of select="data [@alias = 'Text_AF']"/>    
    </xsl:if>
    </xsl:if>

     

    How should I do to protect some text so it just been shown for logged in people ?

     

    Best

    /H

Please Sign in or register to post replies

Write your reply to:

Draft