Copied to clipboard

Flag this post as spam?

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


  • Jordan Wallace 4 posts 35 karma points
    Aug 22, 2013 @ 11:44
    Jordan Wallace
    0

    Public access permissions and Razor Macros

    Hi Guys,

    I'm using 4.9.0

    I've written some code to handle an iframe showing an alttemplate of a child page with a single pagefield on there (couldn't word that better, sorry.), the template is protected.

    While I was building I noticed that general code wasn't effected by the public access permissions, the following code would output everything but the pagefield

    <div class="twelve columns"> <h1>TESTTEXT</h1> <umbraco:Item field="moduleDescription" runat="server" /></div>
    

    As shown here

    TESTTEXT

    I was under the impression that, if you write a macro to handle something that has restricted public access, then you can still output it to those that don't have access, so I made the simplest macro known to man as a work around which was as follows

    @Model.moduleDescription
    

    I tried this, and still got nothing but the TESTTEXT

    <div class="twelve columns"> <h1>TESTTEXT</h1> <umbraco:Macro Alias="ModuleDescription" runat="server"/></div>
    

    I've created macros that take pagefields from restricted parents and output them on the current page before and had no trouble, I know this is slightly different, but what am I missing?

    Thanks

    Jordan

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Aug 24, 2013 @ 16:04
    Jan Skovgaard
    0

    Hi Jordan

    What does the actual Razor code look like?

    /Jan

  • Richard Soeteman 4045 posts 12898 karma points MVP 2x
    Aug 25, 2013 @ 09:03
    Richard Soeteman
    1

    Hi,

    I assume you don't load the complete page in the IFrame but have a page that get's that displays properties via Razor? In case of the last you need to check first if the user has Access to the node

    node.HasAccess()
    

    Protecting pages will protect access to the whole page not the properties.

    Hope this helps,

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft