Is there a way to list all users across all tenants?

In a multi-tenant ABP MVC app, there is a built-in endpoint to list users:

GET: /api/identity/users

This endpoint only shows users belonging to the Current Tenant.

Is there a way to ignore the multi-tenancy filter as the 'host admin', to list all users, across all tenants?

Similarly, can the 'host admin' create/ modify/ delete users in other tenants via the same api/identity/users endpoint?

Or is writing a custom endpoint the only way?


You may not need to write a custom endpoint, but in this case, you need to override the existing service.

Because there is a feature where you can disable the tenant filter wherever you want.

In some cases, you may want to disable it and perform a query on all the data, without filtering for the current tenant.

For more information: https://docs.abp.io/en/abp/latest/Multi-Tenancy#data-filtering-disable-the-multi-tenancy-filter

You can implement this method in the relevant AppService's methods as follows:

public async override Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input)
{
    using (_dataFilter.Disable<IMultiTenant>())
    {
        return await base.CreateAsync(input);
    }       
}

References:

  1. https://docs.abp.io/en/abp/latest/Multi-Tenancy#data-filtering-disable-the-multi-tenancy-filter
  2. https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Overriding-Services#example-overriding-an-application-service