Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Same user in multiple tenants #10311


User avatar
0
Inforis created

Product version

10.2.0

Product type

MVC

Product framework type

.net Core

First of all, I would like to say that all our implementations have worked without any problems, so I would recommend asp.net Zero to every development team.

We implemented a synchronization process that creates users in asp.net Zero. We are using tenants and assign the users to this tenants. Till now a user belongs to a tenant. Now we have the need, that some users have to be member in multiple tenants. I found several support entries, that explain different approaches (linked user, create user in each tenant, single tenant) for this screnario. It seams a little bit difficult to choose the right way, because there are some requirements to meet.

We need to keep the multi tenancy and would like to have the user main data only once (sychronizationid, change pasword, etc). The way i see it, is that in the table AbpUsers this main data is handled and the users connections to the tennants are stored in the table AbpUserAccounts. This brings me know to the question, is this is the right way to do it or do we have to choose another way and do you have some implementation examples for this scenario?

cheers

Stefan


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

    Hi **@Inforis **

    First of all, thanks :).

    A User's tenancy information is kept in AbpUsers table (TenantId field). You can consider AbpUserAccounts table as a duplication of AbpUsers table but this table can be accessed by Host users. AbpUserAccounts table is syncronized with AbpUsers table automatically by AspNet Zero. So, if you create a record on AbpUsers table (using the AspNet Zero services ofcourse), it will be copied to AbpUserAccounts table.

    I think, in your case, it will be better to create duplicate users in AbpUsers table.

  • User Avatar
    0
    Inforis created

    Thank you for the answer! In this case, is there a possibility to keep the user handling only on one place, and not separated for each tenant (like password and settings)? If I have to add the same user to each tenant?

    cheers Stefan

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can do that but you need to make a custom development for this. It is not possile out of the box. You can access all users by disabling multi tenancy filter, see https://aspnetboilerplate.com/Pages/Documents/Data-Filters#disable-filters