Base solution for your next web application
Open Closed

Multi-tenant, multi-db users #3792


User avatar
0
arnoldkesselaar created

Are tenant users stored in the host database?


2 Answer(s)
  • User Avatar
    0
    arnoldkesselaar created

    Ok, I kinda figured it out...

    I have initialised my tenant db with the user I need, when combined with DisableFilter(MayHaveTenant) and SetTenantId(TenantId) I can retrieve the user I want. I guess the users will need to have unique email addresses across tenants, so they can be identified. I will worry about this in the user creation process, so that I validate that the user isn't registered in another tenant (my business rules).

    Is that the correct approach?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ArnoldKesselaar,

    If you decide to use a seperate database for each or some of your tenants, this will be hard to check because each tenant's users stored in it's own database when using DB per tenant approach.

    If you want to use this approach, you can use AbpUserAccounts table, it's the ombination of all users of all tenants including host users. When a user is created/edited/deleted this table is updated as well.

    If you don't want to use DB per tenant approach, you can use your solution.