[Multi-Tenancy] Support for parent-child tenants

[Multi-Tenancy] Support for parent-child tenants

  

Presently, I have made multi-tenancy as per the OS learning videos. The design is shown below-

Tenant 1 (isolated data per tenant)

        Tenant User 1

        Tenant User 2

Tenant 2 (isolated data per tenant)

        Tenant User 3

        Tenant User 4


Now, my requirement is to have one more layer above main tenants like this. Can that me made possible using present multi-tenancy feature ?

Manufacturer Tenant 1

     Tenant 1(isolated data per manufacturer per tenant)

        Tenant User 1

        Tenant User 2

     Tenant 2 (isolated data per manufacturer per tenant)

        Tenant User 1

        Tenant User 2

Manufacturer Tenant 1 (isolated data per manufacturer per tenant)

     Tenant 1

        Tenant User 1

        Tenant User 2

From my knowledge, you can't have child tenants using native tools. You can however create users and screens with permissions to more than one tenant. i.e. you can create a {TenantUser} table with two FK's (userId and TenantId) which will give permissions to the users. Then you must expose the tenantId's and filter by tenantId on the screens you want users to have permissions over more than 1 tenant.

Users however will have to be part of 1 tenant and 1 tenant only. You cannot  create users on two tenants.

My usual approach on this scenarios is to have the regular users created on the tenants they belong to and the "master" users on the "users" tenant.

Just take in consideration that if all your screens and processes expose the tenantId on all screens, the tenantId becomes just another column on the tables and the native MT system will give you more problems than solutions.

By design, OS's multi-tenancy cannot share users among different tenants, as you wish with your 'Tenant User 1' and 'Tenant User 2'.

But you can create an entity to control your second level of tenancy. You have to be aware of filtering data manually when necessary, but it's not a big deal. I've already done that myself a couple times, and it works fine.

There are a couple of components on Forge to help you manage Tenants. I've never used them, but take a look. They might be helpful.

Hi,

please have a look at this component:

https://www.outsystems.com/forge/component/2551/tenantswitch

With it, you can have one user that can access multiple tenants using permissions.

I hope it helps you.

Kind Regards,

Paulo Reis

João Melo wrote:

By design, OS's multi-tenancy cannot share users among different tenants, as you wish with your 'Tenant User 1' and 'Tenant User 2'.

But you can create an entity to control your second level of tenancy. You have to be aware of filtering data manually when necessary, but it's not a big deal. I've already done that myself a couple times, and it works fine.


If I have to maintain my second level of tenancy then that means all my aggregate queries and advance queries will get affected. It will be our responsibility to manage the isolation.