Copied to clipboard

Flag this post as spam?

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


  • MB 113 posts 422 karma points
    May 16, 2019 @ 21:31
    MB
    0

    BackOffice - Get current user's groups ?

    I need to allow a plug-in to adjust content based on whether the user is an admin, editor, etc.

    Using the BackOffice API (is that the official name?) I can see how to get the current user, but can't see how to get their group memberships, short of creating an UmbracoAuthorizedJsonController and a resource promise to call it.

    Anyone know if there is a direct BackOffice API call for this, or do I need to do the controller/resource thing ?

  • Markus Johansson 1945 posts 5898 karma points MVP 2x c-trib
    May 17, 2019 @ 05:36
    Markus Johansson
    0

    Hi!

    Looking at the the documentation it looks like this is not exposed in the ”resource”-service: https://our.umbraco.com/apidocs/v7/ui/#/api/umbraco.resources.usersResource

    But creating your own controller is quite straight forward, in your controller you could probably use the UserService and get the groups: https://our.umbraco.com/apidocs/v7/csharp/api/Umbraco.Core.Services.UserService.html

  • MB 113 posts 422 karma points
    May 17, 2019 @ 06:18
    MB
    0

    Thanks, and yeah, that's what I'd figured - not exposed by the BackOffice API.

    I've written a number of AuthorisedJsonControllers before, so that's not a drama for me - and I'll go that way seeing as there's no client API for it - just would be less work if there was already something in the client API I could call.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies