Open Closed

Assign user to tenants #7038


User avatar
0
i.ullah@fandaqah.com created

Need to assign user to the tenant but didn't find option to assign user to any tenant. kindly guide.

  • ABP Framework version: v8.0.5
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The tenant(TenantId) is set when a user is created.

    https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs#L165

    1. There may be some related user data, so you can delete a user and re-create a new user with a specific tenant
    2. You can change the TenantId of a user by ObjectHelper
    var user = await UserManager.GetByIdAsync
    ObjectHelper.TrySetProperty(user, x => x.TenantId, () => NewTenantId);
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09