Inhibiting data isolation between tenants

Inhibiting data isolation between tenants

  

Hi there, 

I am new to Outsystems and I am starting to play around with multitenancy. 

I have implemented multiple tenants using the TenantManagement module such that each user only sees the data of its relevant tenant. However, I would also like to give users originally assigned to the default User (i.e. with no tenancy) the ability to see all data (belonging to all tenants). The problem though is that I can't seem to access another tenant's data at all from the User default. 

Practically, this would consist of a drop-down list that is only available to users belonging to User (default). This drop-down list would allow the user to select a specific tenant (or all tenants) and see all their data accordingly by filtering by their tenant id.

How should I go about doing this? Would I have to cycle through all tenants and apply tenant switching just to see this data? Surely there is an easier way? 


Any assistance would be greatly appreciated. 


Kind regards, 

Cole

Solution

In the Entity properties, check "Expose Tenant Id", which will show the Tenant ID, and you can then see Tenant ID as an attribute, which you can filter on.

HOWEVER, WITHIN THIS ESPACE:

* TenantId will NOT be automatically populated anymore when creating a record, you will need to add it manually to any new records in the code.

* You will ALWAYS need to add a TenantId filter where you need to restrict by tenant.

THEREFORE:

* Separate your logic, data, and UI

* Put all of this "super admin" UI that needs the exposed Tenant Id in a separate espace

* Put the tenant-specific UI in espaces that do NOT expose the Tenant Id.

J.Ja

Solution

Thank you Justin for your response. That does clarify a few things I was unsure about. 

However, as it is, I am exposing the tenant ids on all my espaces. As such, from what I understand, if I log in as a User (not assigned to any specific tenant) I should see all entity data from all Tenants (with these Tenants and their respective Tenant Users being created in TenantManagement). However, this is not the case.

If is log in as any User, a tenant filter for ''User" is automatically applied even though I have exposed the tenant ids. 

What am I missing? I thought that, if I am logged in as a User (default) tenant, I would simply be able to filter by a tenant id to access data belonging to other tenants  (as the tenant id is exposed so no automatic filer should be imposed). 

Kind regards, 

Cole


Nevermind Justin. I thought that the problem related to tenancy because my aggregate was being restricted automatically. However, I did not realise that the problem was actually just one of the entity joins that had a restrict 'with' where it should have been "with or without".

Thanks once again. Your explanation did help. 

Kind regards, 

Cole