Copied to clipboard

Flag this post as spam?

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


  • Tom Maton 387 posts 660 karma points
    Sep 03, 2009 @ 12:40
    Tom Maton
    0

    using the HasAccess call but getting error in debug

    Hi All,

    I am using the unbraco.library:HasAccess() and when I add it the XSL editor and save it I get no errors, but when I run it on the page I get an error in debugMode

    Input string was not in a correct format.
    Input string was not in a correct format.
      at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
      at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
      at umbraco.cms.businesslogic.web.Access.getProtectedPage(String Path)
      at umbraco.cms.businesslogic.web.Access.HasAccess(Int32 documentId, String path, MembershipUser member)
      at umbraco.library.HasAccess(Int32 NodeId, String Path)

    This is my code I am using to check if the user HasAccess

    <xsl:for-each select="$currentPage/child::node [string(data [@alias='umbracoNaviHide']) != '1']">
      <xsl:if test="boolean(umbraco.library:HasAccess(@id,'{umbraco.library:NiceUrl(@id)}')) = 'true'">
        <li>
            <a href="{umbraco.library:NiceUrl(@id)}">           
                <xsl:value-of select="@nodeName"/>
            </a>
        </li>
      </xsl:if>
    </xsl:for-each>

    Any help greatly appreciated

    Cheers

    Tom

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 03, 2009 @ 13:00
    Dirk De Grave
    0

    Hi tom,

     

    Not sure if this is the correct use of the HasAccess() method from within xslt?

    Have you tried 

    umbraco.library:HasAccess(@id, @path) = true()

    as you're not using the second param in a correct way. It needs the actual path as in "-1,x,y" instead of the url you're passing in your example

     

    Hope this helps.

    Regards,

    /Dirk

     

  • Tom Maton 387 posts 660 karma points
    Sep 03, 2009 @ 13:11
    Tom Maton
    0

    Dirk,

    You have done it again mate!!! Thanks again...

    The reason I did it that way was because of the path requirement said string, but it has just occoured to me that it would require a Uri instead.

    I think I will post this in the Wiki as I think it would benefit the community

    Tom

Please Sign in or register to post replies

Write your reply to:

Draft