Copied to clipboard

Flag this post as spam?

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


  • Lee 1130 posts 3088 karma points
    Sep 22, 2019 @ 07:03
    Lee
    0

    Restrict Access To Custom Tree's Via Users Group (Not Via Attribute)

    I have a section with custom tree's, and I want to restrict access to certain trees to backoffice users in certain groups. The groups that are decided are configurable and come from a config file (So I can't just write them in the tree attribute).

    Looking at the docs it says to use the TreeNodesRendering or RootNodeRendering event. However when you grab the user

    sender.Security.CurrentUser
    

    Firstly it's obsolete? Secondly I can't get the groups? I can get everything I need by doing the following

    var ticket = new HttpContextWrapper(HttpContext.Current).GetUmbracoAuthTicket();
    

    However, I don't want to new up a HttpContextWrapper on every single node render? Am I missing something? Is there an easier way to do what I'm trying to achieve?

Please Sign in or register to post replies

Write your reply to:

Draft