Open Closed

How can the Global Admin Role create records in the context of an individual Tenant #3181


User avatar
0
barrett2474 created
  • ABP Framework version: v5.22
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

The global admin of our site needs to add new records in a table for all our Tenants.. Its kind of a bulk process we have.

Can the global Admin make inserts/updates "in the context" of a Tenant?

Thank you!

John


2 Answer(s)
  • User Avatar
    1
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    See: https://docs.abp.io/en/abp/latest/Multi-Tenancy#change-the-current-tenant

    You can change the current tenant.

    For example:

    var tenants = await TenantRepository.GetListAsync();
    
    foreach(var tenant in tenants)
    {
        using(CurrentTenant.Change(tenant.Id))
        {
            //inserts/updates for a tenant here..
        }
    }
    
  • User Avatar
    0
    barrett2474 created

    that's great - thanks for the fast response!

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11