How to manage multi-tenancy in Forest Admin?

Feature(s) impacted

Managing data

Observed behavior

TL;DR: So far, I have not been able to find a convenient way to switch from an “account” dataset to another. What is the best option?

In most SaaS, data is organized in several accounts (or tenants). In many of them the multi-tenancy is managed at application level. Meaning that data from different tenants will be shared in the same DB then scoped when a user query the DB.

This is the case of my application. I have even went further by de-normalizing the DB and adding a “tenant_id” in every table.

When a user perform an action, I need the result to be scoped by tenant (in order to ensure that support agent do not start to cross data from différent tenants).

The best way I have found to do it so far, is to hide all collection except the tenant collection and navigate from related data only.

This approach has 2 downsides:

  • UI-wise, we are wasting the first column
  • I cannot use segments and have to re-create them as smart relationships (see “documents to match” on the screenshot above)

Another option could be to use the “Scope” feature. However, switching from tenant would become tedious and would require admin rights (that we do not want to give to support agents).

Expected behavior

The perfect solution would be to use the scope feature with a variable that we can easily set from the UI.

I have even check your API to see if I could change a tag on a user from the API. This way, I would create a custom action that would change a “tenant_id” tag on the current user and I would reuse this tag in the global scope. (I do not know if you are still following me :sweat_smile: )

Let me know if you see any other option.

Cheers

Hi @jbescoyez ,

Following what you would expect, I can recommend you to build a Workspace with a dynamic filter on a Collection component.
By using the template in the filters in the configuration, you could display data depending on the current user id or email, if that is what you are using. If it is not what you are using, you can create an Input component and use it as the source of the templated filter.
In addition to that, you can choose the Visibility of the Collection component to not be displayed until the filter has been filled.

I hope that this will fit your need.
I also suggest you to read about our inboxes feature. It is a ticketing system that could also interest you.

Best regards,

Shohan