Copied to clipboard

Flag this post as spam?

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


  • Torleif 11 posts 68 karma points
    Jan 19, 2016 @ 12:40
    Torleif
    0

    Retrieving nodes based on role protection in a Umbraco API controller

    I created an ArticleController that inherits from UmbracoApiController where i return every article in my solution.

    I would like to return the articles accessible to the current member using Role Protection and this controller:

    [HttpGet]
    public HttpResponseMessage Get() {
    var root = Umbraco.TypedContentAtRoot();
    var nodes = root.Descendants("Articles");
    //We need to check the role protection of each node agains current members member groups
    var accessibleArticles = new List<Article>(); 
    return Request.CreateResponse(HttpStatusCode.OK, accessibleArticles );
    }
    

    The solution is running on Umbraco 7.2.8.

    It looks like there have been some changes to the UmbracoHelper library ref: https://github.com/umbraco/Umbraco-CMS/blob/775e63148d9c9e0ba4ffad3b697f6f2e2ca9f28b/src/Umbraco.Web/UmbracoHelper.cs#L428.

    Has anyone used this function in the Umbraco Api Controller context?

    Any tips on how to achieve this is much appreciated!

Please Sign in or register to post replies

Write your reply to:

Draft