Copied to clipboard

Flag this post as spam?

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


  • shahab 4 posts 74 karma points
    May 01, 2023 @ 07:01
    shahab
    0

    Umbraco Member Group and Member Manager Services

    I need to find out the assigned member group to current logged in member in the home page.

    @inject IMemberManager _memberManager;
     var currentUser = await _memberManager.GetCurrentMemberAsync();
    

    this is how I get the current user, but the currentUser has no Member Group attribute. I have two member groups Admin and Basic.

    worth to mention

    @inject IMemberGroupService _memberGroupService;
    var groups = _memberGroupService.GetAll();
    

    just list the group names.

    any idea? cheers

  • Marc Goodson 2155 posts 14406 karma points MVP 9x c-trib
    May 01, 2023 @ 13:50
    Marc Goodson
    0

    Hi Shahab

    I wonder if you could inject IUmbracoUserManager, you can use it for Members or backoffice users

    https://apidocs.umbraco.com/v9/csharp/api/Umbraco.Cms.Core.Security.IUmbracoUserManager-1.html#UmbracoCmsCoreSecurityIUmbracoUserManager1GetRolesAsync_0

    and call GetRolesAsync

    is that what you need?

    regards

    marc

Please Sign in or register to post replies

Write your reply to:

Draft