An implementation of a single database multi-tenancy support for CUBA applications.
The key idea is to use a single application instance to serve multiple tenants - groups of users invisible to each other which don't share any data they have write access to.
The application supports two types of data - common data (shared across tenants), and tenant-specific data. Tenants have read-only access to common data and full access to tenant-specific data. All the tenants have their own admin users which can create tenant users and assign tenant-specific roles and permissions.
This is single database/single schema implementation of multi-tenancy. Tenant-specific data owner is specified by the means of column
TENANT_ID in tenant tables.
All tenant-specific entities implement
HasTenant interface, which simply states that entity should have getter and setter for tenant id attribute.