7 min read #OpenCloud#Tech

OpenCloud · Multi-tenancy

Multi-tenancy: many organizations, one OpenCloud

A hosting provider serving file storage to a hundred schools, clubs or law firms doesn't want to maintain a hundred instances to do it. Between OpenCloud 3.3.0 and 3.7.0, the foundation for tenants on a shared instance took shape: users carry a tenant ID, see only their own tenant and can only share within it. Multi-tenancy is off by default and not yet documented. On top of that, admins with an external user directory get a login toggle they can hide and a soft delete that first deactivates accounts.

If you offer file storage to many small organizations, the math is different from that of a single company. A tenant often has fewer than ten people, sometimes just one. Setting up a separate OpenCloud instance for each would mean running separate services, separate updates, separate monitoring and separate storage overhead for each one. With a few dozen tenants, that becomes an operating model that pays off neither for the hosting provider nor for the customers. One instance for everyone would be cheaper, as long as nobody sees the people from the other organization or accidentally shares something with them.

Up to OpenCloud 3.2, this concept didn't exist. Anyone who could sign in to an instance found everyone else in the people search and could share with all of them.

Tenant ID on the user account

The team documented how the separation should work in an architecture decision record in summer 2025 (ADR 0001, opencloud#896). The guidelines are deliberately narrow: little additional resource usage per tenant, little code, and nobody may see anything from another tenant. Every user belongs to exactly one tenant; moving to another one is not planned. User management lives outside OpenCloud: there is one shared identity provider and one shared LDAP directory in which every user carries an attribute with their tenant ID. Separate storage per tenant and groups within a tenant are explicitly out of scope.

Since 3.3.0, OpenCloud reads this identifier. Which LDAP attribute contains it is set by OC_LDAP_USER_SCHEMA_TENANT_ID; there is no default value. If a user has a tenant ID, the people search only returns users from the same tenant (reva#297), and the server rejects a share with someone from another tenant (reva#295). The separation is therefore enforced on the server, not just in the interface.

3.6.0 added a global switch that explicitly puts an instance into multi-tenant mode: OC_MULTI_TENANT_ENABLED=true (opencloud#1554), false by default. When it is set, the proxy rejects every user without a tenant ID with 401, so that nobody ends up, because of a missing attribute, in a state without a tenant in which they might see everyone. OpenCloud also checks the configuration on startup: the graph service has to run with GRAPH_IDENTITY_BACKEND=cs3, the groups service with GROUPS_DRIVER=null. If that doesn't match, the service refuses to start and logs an error.

Terminal with two startup attempts of OpenCloud 3.7.0: with OC_MULTI_TENANT_ENABLED=true the log ends with “Multi-tenant support is enabled. Only the 'null'-driver is supported by 'groups' service.”, with GROUPS_DRIVER=null added it ends with “The identity backend must be set to 'cs3' for the 'graph' service.”; both times the container has stopped with Exited (1).

Wrong combination, no start: OpenCloud aborts with a message and reports only the first missing requirement each time. Log shortened (OpenCloud 3.7.0).

These two requirements show the limits of the current state. Through the cs3 backend, OpenCloud can read users but not create, modify or delete them; in multi-tenant mode, user management in the admin settings is display-only. With the null driver there are no groups. For tenants with a handful of people that's acceptable, for larger organizations on the same instance less so.

Provisioning via API (planned)

As of 3.7.0, it's still open how a hosting provider creates tenants and users if they don't bring their own LDAP directory with a tenant attribute. The answer is in a second architecture decision record, adopted with 3.6.0 (ADR 0002, opencloud#1548). OpenCloud doesn't use automatic provisioning on first login for this, because then nobody could share with a colleague who has never signed in. Instead, the graph service's existing Education API, which is modeled on the Microsoft Graph Education API, is to become the provisioning interface. A tenant is called “School” there. The hosting provider connects its existing system for creating and deleting accounts to this API and thus keeps the user lifecycle in its own hands. The price is that it has to write an integration for it.

3.7.0 implements a first building block: a tenant's school number and the user attributes primaryRole and identities are no longer mandatory in the API (opencloud#1663), because a hosting provider outside the school context has no use for them. The path described above doesn't work yet, though. So far, the Education API only works with the graph service's LDAP backend, while multi-tenant mode requires the cs3 backend. Search by external ID, which is needed for deletion from a third-party system, is also missing.

If you want to use multi-tenancy in 3.7.0, you therefore need an identity provider and an LDAP directory that you maintain yourself and in which every user carries their tenant ID. The configuration reference lists OC_LDAP_USER_SCHEMA_TENANT_ID with version “next”, but not yet OC_MULTI_TENANT_ENABLED, and there is no guide for multi-tenant operation yet. That makes the current state suitable for pilot projects with technically experienced operators.

Users from LDAP and Keycloak

Two changes from the same period help all admins whose users are maintained in an external directory, with or without tenants.

The first concerns the “Login” setting (“Allowed”) in user management. If the account is locked or unlocked in Keycloak, Active Directory or another identity provider, the same toggle in OpenCloud only causes confusion, because it has no effect where the decision is actually made. Since 3.4.0 you can hide it with FRONTEND_EDIT_LOGIN_ALLOWED_DISABLED=true (opencloud#1406); by default it stays visible. The web interface evaluates the setting starting with 3.5.0 (web#1121); the toggle is then missing both in the details view and when editing a user.

Details view of the test user Dennis Ritchie in user management with the rows User name, First and last name, Email, Role, Login “Allowed”, Quota and Groups.

Default: the details view shows “Login: Allowed” (OpenCloud 3.7.0).

The same details view with FRONTEND_EDIT_LOGIN_ALLOWED_DISABLED=true: the Login row is missing, Role is followed directly by Quota.

With FRONTEND_EDIT_LOGIN_ALLOWED_DISABLED=true the “Login” row is gone (OpenCloud 3.7.0).

The second concerns deletion. Until now, deleting a user removed the account and its personal space immediately. During offboarding that's often too early, because someone still has to take over files or a retention period applies. Since 3.4.0 there is the setting GRAPH_USER_SOFT_DELETE_RETENTION_TIME for this (opencloud#1344), and since 3.6.0 OpenCloud stores the state of each account in a dedicated key-value store in NATS (opencloud#1443). By default the time is set to 0, and deletion stays final. If you set a positive value, such as 720h, the first deletion becomes a deactivation: the account is locked for sign-in, the personal space goes to the trash instead of being removed for good, and OpenCloud records state, time, retention period and reason. Final deletion only happens with a second call to DELETE /graph/v1.0/users/{id} with the header Prefer: purge. If the account is still active, the server rejects this call.

  1. Dialog “Delete user Dennis Ritchie?” with the question “Are you sure you want to delete this user?” and the buttons “Cancel” and “Delete”.
    In user management, deleting looks the same as always; the dialog doesn't mention a retention period.
  2. User list with five users, without dennis; at the bottom right the message “User Dennis Ritchie was deleted successfully”.
    Afterwards the account disappears from the list, and the message says “deleted”.
  3. Sign-in page with user name dennis and the message “Logon failed. Please verify your credentials and try again.”
    Signing in as dennis fails with the usual “Logon failed” message.
  4. Terminal: the account has accountEnabled false, Dennis Ritchie’s personal space has the state trashed; a DELETE with Prefer: purge on the active account lynn returns HTTP 400 “user should be hard deleted, but is still enabled, please soft delete first”, on dennis HTTP 204.
    Via the API, the account is locked and the personal space is in the trash. “Prefer: purge” only deletes the deactivated account; the server rejects it for an active one. Output shortened (OpenCloud 3.7.0, GRAPH_USER_SOFT_DELETE_RETENTION_TIME=720h).

The retention period is stored, but in 3.7.0 there is no job yet that deletes accounts on its own once it has passed, even though the setting's description suggests it. The web interface doesn't send purge when deleting, so a deactivated account can only be removed for good via the API. There is no dedicated step yet that restores a deactivated account along with its personal space. If the directory is read-only for OpenCloud, locking only works if users are disabled via a group (GRAPH_DISABLE_USER_MECHANISM=group). In multi-tenant mode with the cs3 backend, soft delete isn't available, because OpenCloud doesn't delete users there.

Impact on operations

For hosting providers, 3.7.0 has the most important property in place: people from different organizations can work on the same instance without seeing each other or sharing files with each other, and the server enforces this. What's still missing is a way to create tenants and users without your own LDAP directory, and documentation that lets you set this up without reading the code. Soft delete and the hidden login toggle, on the other hand, are usable today on any installation with an external identity provider; both are off by default and each is enabled with a single setting.

Sources