Add Tenants to Administration, and let an account be put in one

A tenant is a separate organisation on one server: its own people,
domains and limits, and an administrator who manages only what is in it.
It gets a section under Access, gated by sysTenantQuery and sysTenantGet,
with a notice on a server that does not report Enterprise, where anyone
inside a tenant is held to an ordinary user's permissions.

The panel edits the tenant's name, logo, role and limits. The logo is an
https address, drawn through the image proxy the strict image policy
requires, or an image data URL. Limits change one quotas/<name> pointer
each, so the four ihasmail does not offer keep their values, and an empty
field is no limit. The role is the most anyone inside can be allowed.

Stalwart keeps no list on a tenant -- each account, group, domain, list and
role names its own -- so what a tenant holds is counted with memberTenantId
queries and shown against its limits. Domains are added and taken out from
the tenant's panel, one memberTenantId change each; only a domain in no
tenant can be added, and its accounts stay where they are. Delete is offered
once every count reads zero.

A tenant does nothing until someone administers it, so the account panel
gains a Tenant choice for an administrator who can read tenants: an
Administrator inside a tenant administers that tenant. Nobody moves their
own account.

The mock has a tenant holding a domain and an administrator, a spare domain
to assign, memberTenantId filters on every query, and Stalwart's rule that
only an administrator outside every tenant may move things into one. A test
of taking a domain back out found that the mock's pointer handling dropped a
top-level null instead of storing it, so nothing had ever been cleared that
way; it stores null now, as the server reads it back.

Nothing about tenants has been written on a live server: production has
none. KNOWN-ISSUES says what was read from source.

Thirty-nine new strings and one plural, in all nine catalogues.
This commit is contained in:
2026-09-15 09:28:39 -07:00
parent 7e46ddeb7d
commit fd104a1f34
29 changed files with 1467 additions and 25 deletions
+31 -3
View File
@@ -1260,6 +1260,35 @@ Its labels are English only, so ihasmail ships its own translation of every one
of them, loaded only when the Roles screen opens; a permission added by a later
Stalwart shows the server's English until it is translated.
## Tenants
A tenant is a separate organisation on the same server — its own people,
domains and limits, and an administrator who manages only what is in it. It is
a Stalwart Enterprise feature: on a server that does not report Enterprise the
page says that anyone inside a tenant has only an ordinary user's permissions.
For a role with `sysTenantQuery` and `sysTenantGet`, under Access:
- **List and search** tenants, with each one's storage and account limit.
- **Create and edit** a tenant's name, logo (an https address, drawn through the
image proxy, or an image data URL), role and limits — accounts, groups,
mailing lists, domains, roles, DKIM keys and storage. An empty limit is no
limit, and a limit ihasmail does not offer keeps whatever it had.
- **The tenant's role** is the most anyone inside it can be allowed: their own
roles are cut down to it.
- **What it holds** is counted, each against its limit. Stalwart keeps no list
on the tenant; each account, group, domain, list and role names its tenant,
so the counts are queries for those.
- **Domains** are added to a tenant, or taken out, from its panel. Only a domain
in no tenant can be added, and the accounts already on it stay where they
are.
- **An account's tenant** is chosen on the account's own panel, which is how a
tenant gets its first administrator: an Administrator inside a tenant
administers that tenant.
- **Delete** is offered once the tenant holds nothing.
Only an administrator outside every tenant can put anything into one; Stalwart
refuses anyone else, and inside a tenant it scopes every list to that tenant.
## Domains
For a role that can read domains (`sysDomainQuery`, `sysDomainGet`):
@@ -1318,9 +1347,8 @@ session information already kept for thirty minutes — so a role granted or
taken away shows in the menu at the next sign-in or within half an hour, and in
the meantime Stalwart refuses what is no longer allowed.
The dashboard, accounts, groups, mailing lists, roles and domains are the
sections so far. Tenants are Stalwart capabilities the same screen is
laid out to take. Beyond the dashboard's counts, managing queues, logs and
The dashboard, accounts, groups, mailing lists, tenants, roles and domains are
the sections so far. Beyond the dashboard's counts, managing queues, logs and
server settings is deliberately out of scope.
---