The OutSystems Platform provides you with the default Users application to perform end-user management. This application is Multi-tenant ready: when set as User Provider of Multi-tenant applications, it automatically constrains end-users to their tenants.

Managing End-Users

By logging in with a tenant administrator end-user, you're allowed to manage end-users on the same tenant. Since end-users are constrained to their tenants, tenant administrators are not able to manage end-users from other tenants.

Avoiding Name Clashing

In Multi-tenant scenarios you should avoid duplicate usernames across all tenants. During the login process, the username is used to infer the correct tenant, and if more than one end-user has the same username, it is impossible to know which tenant to bind the session to.

In this scenario, the User_Login action from the Users module binds the session to the first end-user created and logs in Service Center that a duplicate username was found. In case the session has been bound to an incorrect tenant, the login process fails, raising an invalid login exception. This means that in scenarios with username clashing, only one end-user is able to access the application, all other duplicates are always presented with an invalid login message.

One way to avoid username duplication across tenants is to assign usernames containing <username>@<company>.

Programmatically Creating End-Users

For more complex scenarios, you need to programmatically create a tenant and assign it an administrator. Applications with self-provisioning (where end-users create their own tenant) are one example.

In the business logic of a Multi-tenant application, on the provisioning process:

  1. Use the TenantCreate System action to provision a new tenant;
  2. Design a Web Screen for setting the username and password of the tenant administrator end-user;
  3. Use the Create<Entity> entity action to create the tenant administrator end-user;
  4. Use the GrantRole action, to grant administrator privileges to the newly created tenant administrator end-user.

To learn more about Multi-tenant development and management please refer to the How To Build a Multi-tenant Application technical note.

See also

About Multi-Tenancy |About End-User Management | About Sessions in OutSystems Platform