Base solution for your next web application
Open Closed

Multi-tenant, multi-db users #3892


User avatar
0
arnoldkesselaar created

Hello, great system, thanks for building it!

As mentioned in the subject, we have setup a multi-tenant/multi-database scenario. I am also utilising the AngularJS front end to access the .NET CORE 1.1 API. I am using the "Abp.TenantId" to indicate to the back end api the tenant I wish to act in.

Here is my problem scenario: I have 2 "admin" users who can create other users. Each admin user belongs to a separate tenant. If I login as the admin user for t1 and create a user, that user has a tenant id of "1" (correct). Ok, now, I logout and then login to t2 (second tenant). I create a user for that tenant and the tenant id in the database is still "1"! The record is in the t2 database, which is even more strange....

Can anyone shed some light on this? If I shutdown the api and my browser, then login as t2 admin, the correct "TenantId" value is used.

Thanks for your help, Arnold.


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

    Hi @ArnoldKesselaar,

    Can you check the value of Abp.TenantId request header when creating a user for tenant 2 ?

    Thanks.

  • User Avatar
    0
    arnoldkesselaar created

    Sigh... I found a bug in my tenant mapping function and the wrong tenant was being selected there.

    Thanks for the reply in any case :)

  • User Avatar
    0
    ismcagdas created
    Support Team

    @ArnoldKesselaar, Thanks for the feedback :)