Multi-Tenancy in OutSystems

Multi-Tenancy in OutSystems

Long time, no see.  Questions:

1)  We're building an application in which we need to have multi-tenancy.  The 9.0 documentation says that the Users API is multi-tenant capable, but I don't see a way to assign a tenant to a user, even an admin user.

2)  If we put Users into a multi-tenant capable mode, does that affect all other applications that use Users?  We currently have a large number of eSpaces that use Users.

3)  Is all multi-tenancy handled in a vertical fashion (i.e. all the same table, just separated and filtered via TenantID)?  Is there a way to force a horizontal (separate tables) multi-tenancy to help ensure data segregation (some clients are paranoid)?

1. The tenant ID assigned to entities is the tenant ID of the current session. So if you are currently operating in tenant 16, a new user record (or any other multi-tenant record) will be created in tenant 16.

2. No, exposing the tenant ID on it will only be for the consuming eSpace.

3. Yes, it's done with views, no, there is no other choice.

Hi Chris,

Actually Users works like a view to the Users_MT entity from System (that already is multi-tenant). By using Users, the platform automatically constrains end-user per tenant. But to set your own, you can directly use Users_MT entity.

Since it's a platform feature and due to the way it is implemented, I believe is not possible to force horizontal multi-tenancy.

Best regards,

Thank you for your replies.  Very helpful.

In the Users table in OutSystems, I see that there is a TENANT_ID column, but thus far, I haven't been able to find a way to set that tenant.  So a few more questions:

1)  How do I set a user's tenant ID?  For instance, UserA should be set to CompanyA, and UserB should be CompanyB.
2)  Can a user have multiple or all tenants (for say, a system admin to be able to see everybody's stuff)?

Thanks again.

Chris -

1. I fyou need to CHANGE it you will need to either:

a. Expose Tenant ID on the User entity so you can set it.
b. Work with the User_MT entity so you can set it.

Again, any record in a multi-tenant table that does not have the tenant ID exposed will automatically be set to the current tenant when the record is created.

2. No. Management systems work along these lines:

* Make an eSpace that consumes the Entities you need to read and exposes the tenant ID. These management systems should be "system admin use" only... things like user management.
* Create a "Login As" system in your management (make sure to secure it!) that does not require a user's password so that if you need to work within a particular tenant you can login as someone within it. You don't want to replicate all of your logic in the system management area just for the sake of providing support or whatever.