Show only the Enterprise notice on Tenants when the server is not Enterprise

On a server that does not report Enterprise -- or reports no edition --
tenants hold nobody to anything beyond an ordinary user's permissions, so
the page is the notice alone: no New tenant, no search, no list, and no
tenant query is made. The mock's edition is MOCK_EDITION now (default oss,
as before), so MOCK_EDITION=enterprise brings the section back to work on.
This commit is contained in:
2026-09-15 09:31:10 -07:00
parent fd104a1f34
commit ce5eb04c2d
5 changed files with 101 additions and 15 deletions
+3 -1
View File
@@ -45,6 +45,8 @@ const SHARED_CAPS: Obj = {
const USER = process.env.MOCK_USER ?? "[email protected]";
/** Locale the fake directory reports for the account (POSIX style, as Stalwart does). */
const MOCK_LOCALE = process.env.MOCK_LOCALE ?? "en_US";
/** What /api/account reports. Tenants are managed only on "enterprise"; MOCK_EDITION=enterprise to develop them. */
const MOCK_EDITION = process.env.MOCK_EDITION ?? "oss";
const PASS = process.env.MOCK_PASS ?? "demo";
/**
* Credential state, mutable so the self-service flows can be exercised against
@@ -1430,7 +1432,7 @@ export const server = createServer(async (req, res) => {
// The account info endpoint; the only place a server reports its edition.
if (url.pathname === "/api/account" && req.method === "GET") {
res.writeHead(200, { "content-type": "application/json" });
return res.end(JSON.stringify({ permissions: directory.permissions, edition: "oss", locale: MOCK_LOCALE }));
return res.end(JSON.stringify({ permissions: directory.permissions, edition: MOCK_EDITION, locale: MOCK_LOCALE }));
}
// The registry schema, cut down to the permission list the Roles picker
// reads. Gzipped as the real file is, from the 0.16.22 snapshot the