Base solution for your next web application
Open Closed

How to get all users of a specific role? #9775


User avatar
0
dzungle created

Hello Support Team,

I am using this method to get all users of a specific role, but the result is alway zero.

var topCommanders = await UserManager.GetUsersInRoleAsync("TopCommander");

Could you please help me how to get all users of a specific role?

Thank you,


3 Answer(s)
  • User Avatar
    0
    zony created
    Support Team

    Hi dzungle, Does the role you are looking for exist in the current tenant? This is because the role (AbpRoleBase) will use TenantId to isolate the roles of each tenant. If your role (TopCommander) is not in the current tenant, it will Unable to check.

  • User Avatar
    0
    dzungle created

    Hi Zony,

    I disabled multi tenant feature.

  • User Avatar
    0
    zony created
    Support Team

    Hi dzungle, I will try to disable the tenant to reproduce the problem. It would be better if you have a similar demo.