feat: tenant registry and tenant-scoped requests (multi-tenant foundation, part 1) #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/7-tenant-registry"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
First part of the multi-tenant foundation. Without
DATABASE_HOSTnothing changes: the instance runs without tenants, as before.migrations/).@quatrain/tenancy./t/<tenant>/…: the tenant is read from the path and checked against the membership of the user in the database, never taken from identity provider claims. The roles of the user become those held in that tenant. A tenant the user may not enter (unknown, suspended, not a member) is answered404.yarn admin:migrate,tenant:create,tenant:list,member:add,member:remove,member:list.Documentation:
docs/MULTI-TENANCY.mdanddocs/MULTI-TENANCY.fr.md.Deliberate limit
Only
/t/<tenant>/api/auth/meis served under a tenant URL. Upload, curation, extraction and git routes still read one repository, one storage and one AI provider for the whole instance; they answer404under a tenant URL until each serves the resources of the tenant. A tenant URL therefore never shows data shared with another tenant.Dependencies
@quatrain/tenancy,@quatrain/backend-postgresand@quatrain/identifiersare beta releases needing the beta ofcore,backendandtypes. The other Quatrain packages only accept the previous stable versions, soresolutionspins those three to one version each. To remove once they have a stable release.Checks
yarn test: 36 tests pass (20 new: settings, tenant requests, pipeline step, migrations).yarn build,node dist/server/entry.mjs) with a stand-in identity provider: a member gets200with the roles of the tenant; another tenant, an unknown tenant, a non-member and a route that is not tenant-aware get404; an anonymous request is redirected to the login page.Not checked
Containerfilenow copiesbin/,migrations/andsrc/instance/.yarn devfails ondevelopsources as well as here (exports is not definedin a Quatrain package under Vite), so the run above used the built server.Notes for review
"user"table (two columns, empty): the backend adapter joins it for the author columns of every record and tries to create it when it cannot see it. Its name is imposed by the adapter and is a reserved word, hence the only quoted identifier..yarn/install-state.gzis tracked and changes at each install; it is left out of this pull request.Next parts
Closes #7
🤖 Generated with Claude Code