Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

One owner, any number of admins

Duarte Santos93f1c680d7eb
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d68405236..98779cb7c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,9 @@ for the reports, each with a patch and a test. Self-hosters: please update.
- The Coach forgets a stored API key when its server address moves to another host. Enter it again.
- Request paths the server would have to tidy up (`..`, backslashes) are refused, nginx stops
naming its version, and Android backups no longer include the paired server's sign-in.
+- **One owner, many admins.** Any admin could delete every other admin and then clear the activity
+ log. Now one admin is the owner: only they make or remove admins, delete an admin, clear the log
+ or hand the role on (Admin, tap a user). Existing instances: the oldest admin is the owner.
## v1.4.1 (2026-10-10)
diff --git a/api/openapi.yaml b/api/openapi.yaml
index 939800046..21ccd842d 100644
--- a/api/openapi.yaml
+++ b/api/openapi.yaml
@@ -83,8 +83,11 @@ info:
this API at all).
- `ADMIN_UIDS=<uid>,<uid>`: user ids treated as admins (a `"admin": true` flag on
the user record in `db.json` works too). Admins get the `/api/admin/*` routes.
+ One admin is the owner: the record with `"owner": true`, else the first
+ `ADMIN_UIDS` entry with a profile, else the oldest admin. Only the owner appoints
+ and removes admins, deletes an admin, hands the role on and clears the audit log.
- `FIRST_USER_ADMIN` (default off; `1` turns it on): the first profile registered
- on an instance with no profiles gets that `"admin": true` flag. Decided at
+ on an instance with no profiles gets that `"admin": true` flag and is the owner. Decided at
registration only, never applied to an instance that already has profiles.
- `AUDIT_LOG` (default on), `AUDIT_MAX` (default 5000 events), `AUDIT_DAYS`
(default 90), `AUDIT_IP` (`off` | `net` | `full`, default off) shape the audit
@@ -2251,8 +2254,9 @@ paths:
subscriptions, their live presence, their training history file, their uploaded
photos and videos (`DATA_DIR/uploads/<uid>/`) and any Coach credential stored for
them. Not reversible; `/api/admin/user/disable` is the
- reversible one. An admin cannot delete their own account, and the last admin
- cannot be deleted. Audited by name, since the id stops meaning anything.
+ reversible one. An admin cannot delete their own account, the last admin and
+ the owner cannot be deleted, and only the owner deletes another admin. Audited
+ by name, since the id stops meaning anything.
requestBody:
required: true
content:
@@ -2273,7 +2277,7 @@ paths:
ok: { type: boolean, const: true }
id: { type: string }
'400':
- description: Your own account, or the last admin.
+ description: Your own account, the last admin, or the owner.
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
@@ -2287,6 +2291,90 @@ paths:
schema: { $ref: '#/components/schemas/Error' }
example: { error: "no such user" }
+ /api/admin/user/role:
+ post:
+ tags: [admin]
+ operationId: adminUserRole
+ summary: 'Owner: make someone an admin, or remove the role'
+ description: >-
+ Owner only (403 for any other admin). Not on the owner themselves, not on an
+ admin named in `ADMIN_UIDS` (the server would restore them on restart), and a
+ disabled account is enabled before it can be promoted. Removing the role keeps
+ the account and its data.
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ required: [id, admin]
+ properties:
+ id: { type: string, description: The user id. }
+ admin: { type: boolean }
+ responses:
+ '200':
+ description: Changed.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ ok: { type: boolean, const: true }
+ id: { type: string }
+ admin: { type: boolean }
+ '400':
+ description: The owner, an `ADMIN_UIDS` admin, a disabled account, or no boolean.
+ content:
+ application/json:
+ schema: { $ref: '#/components/schemas/Error' }
+ '401': { $ref: '#/components/responses/Unauthorized' }
+ '403': { $ref: '#/components/responses/Forbidden' }
+ '404':
+ description: No user with that id.
+ content:
+ application/json:
+ schema: { $ref: '#/components/schemas/Error' }
+
+ /api/admin/owner:
+ post:
+ tags: [admin]
+ operationId: adminOwnerTransfer
+ summary: 'Owner: hand the owner role to another admin'
+ description: >-
+ Owner only. The target must already be an enabled admin; the previous owner
+ stays an admin.
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ required: [id]
+ properties:
+ id: { type: string, description: The user id. }
+ responses:
+ '200':
+ description: Handed over.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ ok: { type: boolean, const: true }
+ id: { type: string }
+ '400':
+ description: Yourself, or not an enabled admin.
+ content:
+ application/json:
+ schema: { $ref: '#/components/schemas/Error' }
+ '401': { $ref: '#/components/responses/Unauthorized' }
+ '403': { $ref: '#/components/responses/Forbidden' }
+ '404':
+ description: No user with that id.
+ content:
+ application/json:
+ schema: { $ref: '#/components/schemas/Error' }
+
/api/admin/invites:
get:
tags: [admin]
@@ -2441,9 +2529,9 @@ paths:
post:
tags: [admin]
operationId: adminAuditClear
- summary: 'Admin: clear the activity log'
+ summary: 'Owner: clear the activity log'
description: >-
- Deletes the log file. The clear is itself the first event of the fresh log,
+ Owner only, so no other admin can erase a trace of what they did. Deletes the log file. The clear is itself the first event of the fresh log,
and event ids are never reset, so a wipe always leaves a visible id gap.
responses:
'200':
@@ -3192,6 +3280,7 @@ components:
properties:
id: { type: string, description: Stable user id (16 base64url chars). }
name: { type: string }
+ owner: { type: boolean, description: Present (true) only for the instance owner. }
admin: { type: boolean }
example: { id: "Zk3q9XyPbA2LmN0v", name: "Ada", admin: false }
@@ -3565,6 +3654,7 @@ components:
name: { type: string }
created: { oneOf: [{ type: string }, { type: 'null' }], description: ISO timestamp. }
disabled: { type: boolean }
+ owner: { type: boolean, description: The one admin who manages the others. }
admin: { type: boolean }
invitedBy:
oneOf: [{ type: string }, { type: 'null' }]
@@ -3609,6 +3699,7 @@ components:
name: { type: string }
created: { oneOf: [{ type: string }, { type: 'null' }] }
disabled: { type: boolean }
+ owner: { type: boolean, description: The one admin who manages the others. }
admin: { type: boolean }
invitedBy: { oneOf: [{ type: string }, { type: 'null' }] }
password: { type: boolean, description: PASSWORD_LOGIN instances only. }
diff --git a/api/server.js b/api/server.js
index 0631ebede..491e99a28 100644
--- a/api/server.js
+++ b/api/server.js
@@ -60,6 +60,7 @@ const FIRST_USER_ADMIN = /^(1|true|yes|on)$/i.test(process.env.FIRST_USER_ADMIN
function claimFirstAdmin(req, user) {
if (!FIRST_USER_ADMIN || db.users.length !== 0) return;
user.admin = true;
+ user.owner = true;
audit(req, 'admin.first-user', { user });
}
// Guest mode ("Continue without account") keeps everything in the browser and never touches this
@@ -148,6 +149,22 @@ db.subs = db.subs || [];
db.invites = db.invites || [];
db.deviceLinks = db.deviceLinks || []; // unused one-time device links, hashed (device-link.js)
const isAdmin = user => !!user && (user.admin === true || ADMIN_UIDS.includes(user.id));
+// One owner per instance, any number of admins. Admins run the place day to day (users, invites,
+// the Coach); the owner is the one admin the others cannot act on: only the owner appoints or
+// removes admins, deletes an admin's account, hands the role on, or clears the activity log.
+// Without this any admin could delete every other admin and then wipe the log of having done it.
+// The owner is whoever carries `owner: true` (the first profile under FIRST_USER_ADMIN, or a
+// handover); an instance from before the role has none, so it falls to the first ADMIN_UIDS entry
+// that has a profile, then to the oldest admin record. Decided on every call, never cached, so a
+// deleted or demoted owner cannot leave the instance without one.
+function ownerId() {
+ const flagged = db.users.find(u => u.owner === true && isAdmin(u));
+ if (flagged) return flagged.id;
+ const fromEnv = ADMIN_UIDS.find(id => db.users.some(u => u.id === id));
+ if (fromEnv) return fromEnv;
+ return db.users.find(isAdmin)?.id || null;
+}
+const isOwner = user => !!user && isAdmin(user) && user.id === ownerId();
// 0600: db.json holds passkey credential material. It used to be covered by a blanket 0700 on
// the whole directory; now that the directory stays traversable, the file carries its own mode.
// Once the new version is on disk, a second copy of it goes to db.json.bak, the same durable
@@ -673,6 +690,11 @@ function requireAdmin(req, res) {
if (!isAdmin(user)) { audit(req, 'admin.denied', { ok: false, user }); json(res, 403, { error: 'forbidden' }); return null; }
return user;
}
+function requireOwner(req, res) {
+ const user = requireAdmin(req, res); if (!user) return null;
+ if (!isOwner(user)) { audit(req, 'admin.denied', { ok: false, user }); json(res, 403, { error: 'only the owner can do this' }); return null; }
+ return user;
+}
const expireCookie = name => `${name}=; Path=/; Max-Age=0; HttpOnly;${SECURE} SameSite=Lax`;
function sessionCookie(user) {
const fresh = `${COOKIE}=${makeSession(user, 'c')}; Path=/; Max-Age=${SESSION_DAYS * 86400}; HttpOnly;${SECURE} SameSite=Lax`;
@@ -1184,7 +1206,7 @@ function loginTarget(body) {
}
const acctKey = u => 'acct:' + u.id;
const passkeyCount = u => db.creds.filter(c => c.userId === u.id).length;
-const publicUser = u => ({ id: u.id, name: u.name, admin: isAdmin(u) });
+const publicUser = u => ({ id: u.id, name: u.name, admin: isAdmin(u), ...(isOwner(u) ? { owner: true } : {}) });
const POLICY_ERRORS = {
'too-short': `the password needs at least ${MIN_LENGTH} characters`,
'too-long': `the password can have at most ${MAX_LENGTH} characters`,
@@ -2068,7 +2090,7 @@ const routes = {
if (!s) return json(res, 401, { error: 'not signed in' });
const { user } = s;
const renew = s.bearer && s.kind !== 'c' && s.exp - Date.now() < SESSION_DAYS * 86400000 / 2;
- json(res, 200, { user: { id: user.id, name: user.name, admin: isAdmin(user) }, ...(renew ? { token: makeSession(user) } : {}) });
+ json(res, 200, { user: publicUser(user), ...(renew ? { token: makeSession(user) } : {}) });
},
'POST /api/register/options': async (req, res) => {
@@ -2146,7 +2168,7 @@ const routes = {
});
saveDb();
audit(req, 'auth.register.ok', { user, msg: invite ? invite.code : null });
- json(res, 200, { user: { id: user.id, name: user.name, admin: isAdmin(user) } }, { 'Set-Cookie': sessionCookie(user) });
+ json(res, 200, { user: publicUser(user) }, { 'Set-Cookie': sessionCookie(user) });
},
'POST /api/login/options': async (req, res) => {
@@ -2208,7 +2230,7 @@ const routes = {
return json(res, 403, { error: 'this account has been disabled', code: 'disabled' });
}
audit(req, 'auth.login.ok', { user });
- json(res, 200, { user: { id: user.id, name: user.name, admin: isAdmin(user) } }, { 'Set-Cookie': sessionCookie(user) });
+ json(res, 200, { user: publicUser(user) }, { 'Set-Cookie': sessionCookie(user) });
},
// Reads the session purely so the sign-out can be recorded; the cookie is cleared either way.
@@ -2267,7 +2289,7 @@ const routes = {
return json(res, 400, { error: 'invalid or expired code', code: 'pair-invalid' });
}
audit(req, 'auth.pair.ok', { user });
- json(res, 200, { token: makeSession(user), user: { id: user.id, name: user.name, admin: isAdmin(user) } });
+ json(res, 200, { token: makeSession(user), user: publicUser(user) });
},
// Absent entirely while PASSWORD_LOGIN is off, so each of them is a plain 404.
@@ -2540,7 +2562,7 @@ const routes = {
const last = workouts[workouts.length - 1];
return {
id: u.id, name: u.name, created: u.created || null,
- disabled: !!u.disabled, admin: isAdmin(u), invitedBy: u.invitedBy || null,
+ disabled: !!u.disabled, admin: isAdmin(u), owner: isOwner(u), invitedBy: u.invitedBy || null,
workouts: workouts.length,
lastWorkout: last ? last.d : null,
lastSync: lastSyncOf(u, S),
@@ -2563,7 +2585,7 @@ const routes = {
const S = readState(u.id) || {};
json(res, 200, {
user: {
- id: u.id, name: u.name, created: u.created || null, disabled: !!u.disabled, admin: isAdmin(u), invitedBy: u.invitedBy || null,
+ id: u.id, name: u.name, created: u.created || null, disabled: !!u.disabled, admin: isAdmin(u), owner: isOwner(u), invitedBy: u.invitedBy || null,
// Only on an instance with password sign-in: whether they have one, and until when an
// unused reset code is good.
...(PASSWORD_LOGIN ? { password: hasPassword(u), email: u.email || null, resetUntil: u.pwReset?.exp > Date.now() ? u.pwReset.exp : null } : {})
@@ -2606,6 +2628,8 @@ const routes = {
if (!u) return json(res, 404, { error: 'no such user' });
if (u.id === admin.id) return json(res, 400, { error: 'you cannot delete your own account' });
if (isAdmin(u) && db.users.filter(isAdmin).length <= 1) return json(res, 400, { error: 'cannot delete the last admin' });
+ if (isOwner(u)) return json(res, 400, { error: 'the owner cannot be deleted; hand the role to another admin first' });
+ if (isAdmin(u) && !isOwner(admin)) { audit(req, 'admin.denied', { ok: false, user: admin, target: u }); return json(res, 403, { error: 'only the owner can delete an admin' }); }
const name = u.name;
db.users = db.users.filter(x => x.id !== u.id);
db.creds = (db.creds || []).filter(c => c.userId !== u.id);
@@ -2623,6 +2647,39 @@ const routes = {
json(res, 200, { ok: true, id: u.id });
},
+ // Appoint or remove an admin. Owner only, never on themselves, and not for an admin named in
+ // ADMIN_UIDS: that one comes back on the next restart whatever db.json says, so the switch
+ // would lie. A disabled account is enabled first, so nobody is promoted while locked out.
+ 'POST /api/admin/user/role': async (req, res) => {
+ const owner = requireOwner(req, res); if (!owner) return;
+ const body = await readBody(req);
+ const u = db.users.find(x => x.id === body.id);
+ if (!u) return json(res, 404, { error: 'no such user' });
+ if (u.id === owner.id) return json(res, 400, { error: 'the owner stays an admin' });
+ if (typeof body.admin !== 'boolean') return json(res, 400, { error: 'admin must be true or false' });
+ if (ADMIN_UIDS.includes(u.id)) return json(res, 400, { error: 'this admin is set in ADMIN_UIDS on the server' });
+ if (body.admin && u.disabled) return json(res, 400, { error: 'enable the account first' });
+ if (body.admin) u.admin = true; else { delete u.admin; delete u.owner; }
+ saveDb();
+ audit(req, body.admin ? 'admin.role.grant' : 'admin.role.revoke', { user: owner, target: u });
+ json(res, 200, { ok: true, id: u.id, admin: isAdmin(u) });
+ },
+
+ // Hand the owner role to another admin. The old owner stays an admin.
+ 'POST /api/admin/owner': async (req, res) => {
+ const owner = requireOwner(req, res); if (!owner) return;
+ const body = await readBody(req);
+ const u = db.users.find(x => x.id === body.id);
+ if (!u) return json(res, 404, { error: 'no such user' });
+ if (u.id === owner.id) return json(res, 400, { error: 'you already are the owner' });
+ if (!isAdmin(u) || u.disabled) return json(res, 400, { error: 'make them an admin first' });
+ for (const x of db.users) delete x.owner;
+ u.owner = true;
+ saveDb();
+ audit(req, 'admin.owner.transfer', { user: owner, target: u });
+ json(res, 200, { ok: true, id: u.id });
+ },
+
'GET /api/admin/invites': async (req, res) => {
if (!requireAdmin(req, res)) return;
// resolve usedBy uid → name for display
@@ -2688,8 +2745,9 @@ const routes = {
// Deleting the log is itself logged, and auditSeq is not reset — so a clear always leaves a
// visible gap in the ids and can't be used to quietly erase a trace. There is no export route:
// ./data/audit.log already is the export, in a format jq reads directly.
+ // Owner only: an admin who could clear it could erase the trace of what they did.
'POST /api/admin/audit/clear': async (req, res) => {
- const admin = requireAdmin(req, res); if (!admin) return;
+ const admin = requireOwner(req, res); if (!admin) return;
try { fs.unlinkSync(auditFile); } catch { /* nothing logged yet */ }
auditCount = 0;
audit(req, 'admin.audit.clear', { user: admin });
diff --git a/api/test/server-admin-delete.test.js b/api/test/server-admin-delete.test.js
index 2ce62fcc0..cd5cbe799 100644
--- a/api/test/server-admin-delete.test.js
+++ b/api/test/server-admin-delete.test.js
@@ -52,6 +52,10 @@ async function startServer(t, { twoAdmins = false } = {}) {
const r = await fetch(`${h.api}/api/admin/user/delete`, { method: 'POST', headers: { ...as(uid), Origin: 'http://localhost:8080' }, body: JSON.stringify({ id }) });
return { status: r.status, body: await r.json() };
};
+ h.post = async (route, body, uid = ADMIN) => {
+ const r = await fetch(`${h.api}${route}`, { method: 'POST', headers: { ...as(uid), Origin: 'http://localhost:8080' }, body: JSON.stringify(body) });
+ return { status: r.status, body: await r.json() };
+ };
h.db = () => JSON.parse(fs.readFileSync(path.join(h.dataDir, 'db.json'), 'utf8'));
h.stackFrames = () => h.log.split('\n').filter(l => /^\s+at /.test(l)).length;
return h;
@@ -94,13 +98,53 @@ test('refuses the two deletions that cannot be undone', async t => {
assert.equal(h.db().users.length, 2, 'nothing was removed');
});
-test('another admin can be deleted while one remains', async t => {
+test('the owner can delete another admin', async t => {
const h = await startServer(t, { twoAdmins: true });
- const res = await h.del(ADMIN2);
+ const res = await h.del(ADMIN2); // ADMIN is the oldest admin record, so the owner
assert.equal(res.status, 200);
assert.deepEqual(h.db().users.map(u => u.id).sort(), [ADMIN, VICTIM].sort());
});
+test('an admin who is not the owner cannot delete the owner or clear the log', async t => {
+ const h = await startServer(t, { twoAdmins: true });
+ const owner = await h.del(ADMIN, ADMIN2);
+ assert.equal(owner.status, 400);
+ assert.match(owner.body.error, /owner cannot be deleted/);
+ const clear = await h.post('/api/admin/audit/clear', {}, ADMIN2);
+ assert.equal(clear.status, 403);
+ assert.equal(h.db().users.length, 3, 'nothing was removed');
+ // Still an admin for everything else: an ordinary account goes.
+ assert.equal((await h.del(VICTIM, ADMIN2)).status, 200);
+});
+
+test('only the owner appoints and removes admins, and can hand the role on', async t => {
+ const h = await startServer(t, { twoAdmins: true });
+ assert.equal((await h.post('/api/admin/user/role', { id: VICTIM, admin: true }, ADMIN2)).status, 403, 'an admin cannot appoint');
+ assert.equal((await h.post('/api/admin/user/role', { id: ADMIN, admin: false }, ADMIN2)).status, 403, 'nor demote the owner');
+ assert.equal((await h.post('/api/admin/user/role', { id: ADMIN, admin: false })).status, 400, 'the owner stays an admin');
+
+ assert.equal((await h.post('/api/admin/user/role', { id: VICTIM, admin: true })).status, 200);
+ assert.equal(h.db().users.find(u => u.id === VICTIM).admin, true);
+ assert.equal((await h.post('/api/admin/user/role', { id: VICTIM, admin: false })).status, 200);
+ assert.equal(h.db().users.find(u => u.id === VICTIM).admin, undefined);
+
+ assert.equal((await h.post('/api/admin/owner', { id: VICTIM })).status, 400, 'only an admin can become owner');
+ assert.equal((await h.post('/api/admin/owner', { id: ADMIN2 })).status, 200);
+ const list = (await (await fetch(`${h.api}/api/admin/users`, { headers: as(ADMIN) })).json()).users;
+ assert.deepEqual(list.filter(u => u.owner).map(u => u.id), [ADMIN2]);
+ // The old owner is an admin like any other now.
+ assert.equal((await h.post('/api/admin/audit/clear', {}, ADMIN)).status, 403);
+ assert.equal((await h.del(ADMIN, ADMIN2)).status, 200, 'the new owner can remove them');
+});
+
+test('an admin cannot delete another admin', async t => {
+ const h = await startServer(t, { twoAdmins: true });
+ await h.post('/api/admin/user/role', { id: VICTIM, admin: true });
+ const res = await h.del(VICTIM, ADMIN2);
+ assert.equal(res.status, 403);
+ assert.equal(h.db().users.length, 3);
+});
+
test('says so plainly when the account is not there, and needs an admin', async t => {
const h = await startServer(t);
const missing = await h.del('nobody');
diff --git a/frontend/src/lib/audit.js b/frontend/src/lib/audit.js
index 173fc2231..00018fdc1 100644
--- a/frontend/src/lib/audit.js
+++ b/frontend/src/lib/audit.js
@@ -57,12 +57,15 @@ const LABELS = {
'admin.user.enable': 'Re-enabled an account',
'admin.user.delete': 'Deleted an account',
'admin.password.reset': 'Issued a password reset code',
+ 'admin.role.grant': 'Made someone an admin',
+ 'admin.role.revoke': 'Removed someone as admin',
+ 'admin.owner.transfer': 'Handed the owner role on',
'admin.invite.create': 'Created an invite code',
'admin.invite.revoke': 'Revoked an invite code',
'admin.audit.clear': 'Cleared the activity log',
// FIRST_USER_ADMIN=1: the first profile on a fresh instance is made admin as it signs up.
'admin.first-user': 'Became admin as the first profile',
- 'admin.denied': 'Blocked from the admin dashboard',
+ 'admin.denied': 'Blocked from an admin action',
// Photos and videos of custom exercises: "Reset everything" clearing a profile's files, and the
// upload or clean-up throttle pausing a profile (`msg` says which).
'media.sweep': 'Cleared unused photos and videos',
diff --git a/frontend/src/views/Admin.jsx b/frontend/src/views/Admin.jsx
index f17463469..3760c0fff 100644
--- a/frontend/src/views/Admin.jsx
+++ b/frontend/src/views/Admin.jsx
@@ -44,7 +44,7 @@ function ResetCodeSheet({ name, email, code, expires, close }) {
</>
}
-function UserDetail({ id, onChanged, close }) {
+function UserDetail({ id, viewerOwner, onChanged, close }) {
const [d, setD] = useState(null)
const toast = useUI(s => s.toast)
const openSheet = useUI(s => s.openSheet)
@@ -76,6 +76,18 @@ function UserDetail({ id, onChanged, close }) {
.then(() => { toast(disabled ? 'User disabled' : 'User enabled'); onChanged(); close() })
.catch(e => toast(e.message))
}
+ // One owner, any number of admins: only the owner appoints, removes or hands the role on.
+ const setRole = admin => api('/api/admin/user/role', { method: 'POST', body: JSON.stringify({ id: u.id, admin }) })
+ .then(() => { toast(admin ? u.name + ' is an admin now' : u.name + ' is no longer an admin'); onChanged(); close() })
+ .catch(e => toast(e.message))
+ const makeOwner = () => confirmSheet({
+ title: 'Make ' + u.name + ' the owner?',
+ message: 'They get everything you can do here, including removing admins and clearing the activity log. You stay an admin, but only they can change that.',
+ confirmText: 'Hand it over', danger: true,
+ onConfirm: () => api('/api/admin/owner', { method: 'POST', body: JSON.stringify({ id: u.id }) })
+ .then(() => { toast(u.name + ' owns this instance now'); onChanged(); close() })
+ .catch(e => toast(e.message)),
+ })
// Password sign-in (#118): the server only sends `password` when the instance offers it. The
// code comes back once, is shown once, and is never stored anywhere but as a hash.
const pwInstance = typeof u.password === 'boolean'
@@ -91,7 +103,7 @@ function UserDetail({ id, onChanged, close }) {
return <>
<h3 className="capitalize">{u.name}</h3>
<div className="row" style={{ gap: 6, flexWrap: 'wrap', margin: '8px 0 12px' }}>
- {u.admin && <span className="adm-pill acc">admin</span>}
+ {u.owner ? <span className="adm-pill acc">owner</span> : u.admin && <span className="adm-pill acc">admin</span>}
{u.disabled && <span className="adm-pill bad">disabled</span>}
{u.invitedBy && <span className="adm-pill">invite {u.invitedBy}</span>}
{u.password && <span className="adm-pill">password</span>}
@@ -107,6 +119,18 @@ function UserDetail({ id, onChanged, close }) {
<div className="tile"><div className="l">Routines</div><div className="v" style={{ fontSize: '1.1rem' }}>{d.routines.length}</div></div>
<div className="tile"><div className="l">Last sync</div><div className="v" style={{ fontSize: '.95rem' }}>{rel(d.lastSync)}</div></div>
</div>
+ {viewerOwner && !u.owner && !u.disabled && <>
+ <button className="btn" style={{ margin: '12px 0 4px' }}
+ onClick={() => u.admin
+ ? confirmSheet({ title: 'Remove ' + u.name + ' as admin?', message: 'They keep their account and data, but lose this page.', confirmText: 'Remove admin', danger: true, onConfirm: () => setRole(false) })
+ : confirmSheet({ title: 'Make ' + u.name + ' an admin?', message: 'They can see everyone on this instance, disable accounts, hand out invites and set up the Coach. Only you can add or remove admins.', confirmText: 'Make admin', onConfirm: () => setRole(true) })}>
+ {u.admin ? 'Remove admin' : 'Make admin'}</button>
+ <div className="adm-hint">{u.admin ? 'Admins run the instance with you. Remove the role to delete or disable their account.' : 'Admins help run the instance. You stay the owner.'}</div>
+ {u.admin && <>
+ <button className="btn" style={{ margin: '14px 0 4px' }} onClick={makeOwner}>Make owner</button>
+ <div className="adm-hint">There is one owner. Handing it over makes you a regular admin.</div>
+ </>}
+ </>}
{!u.admin && <>
<button className={'btn ' + (u.disabled ? 'primary' : 'danger')} style={{ margin: '12px 0 4px' }}
onClick={() => u.disabled ? setDisabled(false)
@@ -195,7 +219,7 @@ function InvitesCard({ invites, reload, inviteOnly }) {
// Who signed in, who tried and failed, what an admin changed. A card rather than its own route:
// the dashboard is deliberately one page of cards, and the 95 % use of this is a glance at the
// last twenty events. Paging follows Library.jsx's house style — "Show more", not page numbers.
-function AuditCard({ tick }) {
+function AuditCard({ tick, owner }) {
const toast = useUI(s => s.toast)
const [meta, setMeta] = useState(null) // last response minus the rows: total, retention, …
const [rows, setRows] = useState([])
@@ -221,7 +245,8 @@ function AuditCard({ tick }) {
return <div className="card">
<div className="row between"><h2 style={{ margin: 0 }}>Activity log</h2>
- <button className="iconbtn adm-iconbtn" style={{ color: 'var(--red)' }} onClick={clear} aria-label="clear log"><Icon name="trash" /></button></div>
+ {/* Clearing is the owner's alone: an admin could otherwise erase what they did. */}
+ {owner && <button className="iconbtn adm-iconbtn" style={{ color: 'var(--red)' }} onClick={clear} aria-label="clear log"><Icon name="trash" /></button>}</div>
<div className="adm-lead">
Who signed in, what failed, and what an admin changed.
{meta ? ' ' + fmtNum(meta.total) + ' events'
@@ -276,7 +301,9 @@ export default function Admin() {
useEffect(() => { if (!user?.admin) return; loadUsers(); loadInvites(); const iv = setInterval(loadUsers, 15000); return () => clearInterval(iv) }, [])
if (!user?.admin) return null
- const openUser = id => openSheet(close => <UserDetail id={id} onChanged={loadUsers} close={close} />)
+ // From the list rather than the stored session, which may predate a handover.
+ const viewerOwner = !!(users || []).find(u => u.id === user.id)?.owner
+ const openUser = id => openSheet(close => <UserDetail id={id} viewerOwner={viewerOwner} onChanged={loadUsers} close={close} />)
const liveUsers = (users || []).filter(u => u.live)
const activeCount = (users || []).filter(u => u.lastSync && Date.now() - u.lastSync < 7 * 86400000).length
const disabledCount = (users || []).filter(u => u.disabled).length
@@ -328,7 +355,7 @@ export default function Admin() {
<div className="adm-lead">Everyone with a profile on this instance. Tap one to see their activity, to disable the account (nothing is deleted) or to delete it with all their data for good.</div>
<div className="list">
{(users || []).map(u => <div key={u.id} className="item" onClick={() => openUser(u.id)} style={u.disabled ? { opacity: .55 } : null}>
- <div className="grow"><div className="tt">{u.live && <Icon name="dot" style={{ fontSize: 9, color: 'var(--green)', display: 'inline-block', marginInlineEnd: 5 }} />}{u.name} {u.admin && <span className="adm-pill acc" style={{ marginInlineStart: 4 }}>admin</span>}{u.disabled && <span className="adm-pill bad" style={{ marginInlineStart: 4 }}>disabled</span>}</div>
+ <div className="grow"><div className="tt">{u.live && <Icon name="dot" style={{ fontSize: 9, color: 'var(--green)', display: 'inline-block', marginInlineEnd: 5 }} />}{u.name} {u.admin && <span className="adm-pill acc" style={{ marginInlineStart: 4 }}>{u.owner ? 'owner' : 'admin'}</span>}{u.disabled && <span className="adm-pill bad" style={{ marginInlineStart: 4 }}>disabled</span>}</div>
<div className="ss">{u.live ? 'training now · ' + u.live.name : u.workouts + ' workouts' + (u.lastWorkout ? ' · last ' + fmtDate(u.lastWorkout) : '') + ' · last sync ' + rel(u.lastSync)}</div>
{u.email && <div className="ss" title="sign-in e-mail">{u.email}</div>}</div>
{u.hasPush && <Icon name="bell" title="push notifications on" style={{ fontSize: 15, color: 'var(--label-3)' }} />}<Icon name="chevronRight" className="chev" />
@@ -337,6 +364,6 @@ export default function Admin() {
</div>
</div>
- <div style={{ marginTop: 14 }}><AuditCard tick={tick} /></div>
+ <div style={{ marginTop: 14 }}><AuditCard tick={tick} owner={viewerOwner} /></div>
</div>
}
diff --git a/frontend/src/views/Admin.test.jsx b/frontend/src/views/Admin.test.jsx
index 54c4e9e4c..cad12e039 100644
--- a/frontend/src/views/Admin.test.jsx
+++ b/frontend/src/views/Admin.test.jsx
@@ -122,3 +122,31 @@ describe('Admin when the users cannot be loaded', () => {
expect([...page.querySelectorAll('.item')].some(el => el.textContent.includes('Mallory'))).toBe(true)
})
})
+
+// One owner, any number of admins: only the owner sees the role buttons and the log's clear.
+describe('Admin roles', () => {
+ const openMallory = async () => {
+ const page = render(<Admin />)
+ await settle()
+ act(() => [...page.querySelectorAll('.item')].find(el => el.textContent.includes('Mallory')).click())
+ const sheet = render(mocks.sheets[0](() => {}))
+ await settle()
+ return { page, buttons: [...sheet.querySelectorAll('button')].map(b => b.textContent) }
+ }
+ it('the owner can make someone an admin, and clear the log', async () => {
+ mocks.answers['/api/admin/users'].users.push({ id: 'adm', name: 'Admin', admin: true, owner: true, workouts: 0 })
+ mocks.answers['/api/admin/audit'] = { events: [], enabled: true, total: 0, retention: {} }
+ const { page, buttons } = await openMallory()
+ expect(buttons).toContain('Make admin')
+ expect(page.querySelector('[aria-label="clear log"]')).toBeTruthy()
+ expect(page.textContent).toContain('owner')
+ })
+ it('an admin who is not the owner gets neither', async () => {
+ mocks.answers['/api/admin/users'].users.push({ id: 'adm', name: 'Admin', admin: true, owner: false, workouts: 0 })
+ mocks.answers['/api/admin/audit'] = { events: [], enabled: true, total: 0, retention: {} }
+ const { page, buttons } = await openMallory()
+ expect(buttons).not.toContain('Make admin')
+ expect(buttons).toContain('Disable account')
+ expect(page.querySelector('[aria-label="clear log"]')).toBeNull()
+ })
+})
diff --git a/website/api.html b/website/api.html
index b8349e78a..7e5e0b587 100644
--- a/website/api.html
+++ b/website/api.html
@@ -245,7 +245,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<p class="api-facts">
<span>OpenAPI 3.1.0</span>
<span>openGym v1.4.1</span>
- <span>69 endpoints</span>
+ <span>71 endpoints</span>
<span>AGPL-3.0-or-later</span>
</p>
@@ -277,7 +277,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
</div>
<div class="ov">
<h3>Environment-dependent behavior</h3>
-<ul><li><code>INVITE_ONLY=1</code>: registration requires a valid invite code (minted by an admin).</li><li><code>ALLOW_GUEST=0</code>: hides the client-side &quot;continue without account&quot; mode; the server merely reports the flag via <code>GET /api/config</code> (guest mode never talks to this API at all).</li><li><code>ADMIN_UIDS=&lt;uid&gt;,&lt;uid&gt;</code>: user ids treated as admins (a <code>&quot;admin&quot;: true</code> flag on the user record in <code>db.json</code> works too). Admins get the <code>/api/admin/*</code> routes.</li><li><code>FIRST_USER_ADMIN</code> (default off; <code>1</code> turns it on): the first profile registered on an instance with no profiles gets that <code>&quot;admin&quot;: true</code> flag. Decided at registration only, never applied to an instance that already has profiles.</li><li><code>AUDIT_LOG</code> (default on), <code>AUDIT_MAX</code> (default 5000 events), <code>AUDIT_DAYS</code> (default 90), <code>AUDIT_IP</code> (<code>off</code> | <code>net</code> | <code>full</code>, default off) shape the audit log served by <code>GET /api/admin/audit</code>.</li><li><code>PASSWORD_LOGIN=1</code>: adds the <code>password</code> routes and <code>password_login: true</code> in <code>GET /api/config</code>. Off by default.</li><li><code>DEFAULT_LANG</code> (e.g. <code>pt-BR</code>; unset by default): <code>default_lang</code> in <code>GET /api/config</code>, the language of the sign-in screen and of every profile that never picked one.</li><li><code>TRUST_PROXY=1</code>: the throttle reads the client address from proxy headers (set by the bundled <code>docker-compose.yml</code>, where only the web container can reach the API).</li><li><code>MEDIA_UPLOADS</code> (default on; <code>0</code> removes the <code>media</code> routes and the <code>media</code> block of <code>GET /api/config</code>), <code>MEDIA_QUOTA_MB</code> (200 per profile, <code>0</code> = no cap), <code>MEDIA_IMAGE_MAX_MB</code> (2), <code>MEDIA_GIF_MAX_MB</code> (8), <code>MEDIA_VIDEO_MAX_MB</code> (40), <code>MEDIA_VIDEO_MAX_SEC</code> (60), <code>MEDIA_GC_GRACE_DAYS</code> (14), <code>MEDIA_UPLOADS_PER_HOUR</code> (600 per profile), <code>MEDIA_MIN_FREE_MB</code> (512, <code>0</code> = no floor): photos and videos of custom exercises (tag <code>media</code>). Every MB here is 2^20 bytes.</li></ul>
+<ul><li><code>INVITE_ONLY=1</code>: registration requires a valid invite code (minted by an admin).</li><li><code>ALLOW_GUEST=0</code>: hides the client-side &quot;continue without account&quot; mode; the server merely reports the flag via <code>GET /api/config</code> (guest mode never talks to this API at all).</li><li><code>ADMIN_UIDS=&lt;uid&gt;,&lt;uid&gt;</code>: user ids treated as admins (a <code>&quot;admin&quot;: true</code> flag on the user record in <code>db.json</code> works too). Admins get the <code>/api/admin/*</code> routes. One admin is the owner: the record with <code>&quot;owner&quot;: true</code>, else the first <code>ADMIN_UIDS</code> entry with a profile, else the oldest admin. Only the owner appoints and removes admins, deletes an admin, hands the role on and clears the audit log.</li><li><code>FIRST_USER_ADMIN</code> (default off; <code>1</code> turns it on): the first profile registered on an instance with no profiles gets that <code>&quot;admin&quot;: true</code> flag and is the owner. Decided at registration only, never applied to an instance that already has profiles.</li><li><code>AUDIT_LOG</code> (default on), <code>AUDIT_MAX</code> (default 5000 events), <code>AUDIT_DAYS</code> (default 90), <code>AUDIT_IP</code> (<code>off</code> | <code>net</code> | <code>full</code>, default off) shape the audit log served by <code>GET /api/admin/audit</code>.</li><li><code>PASSWORD_LOGIN=1</code>: adds the <code>password</code> routes and <code>password_login: true</code> in <code>GET /api/config</code>. Off by default.</li><li><code>DEFAULT_LANG</code> (e.g. <code>pt-BR</code>; unset by default): <code>default_lang</code> in <code>GET /api/config</code>, the language of the sign-in screen and of every profile that never picked one.</li><li><code>TRUST_PROXY=1</code>: the throttle reads the client address from proxy headers (set by the bundled <code>docker-compose.yml</code>, where only the web container can reach the API).</li><li><code>MEDIA_UPLOADS</code> (default on; <code>0</code> removes the <code>media</code> routes and the <code>media</code> block of <code>GET /api/config</code>), <code>MEDIA_QUOTA_MB</code> (200 per profile, <code>0</code> = no cap), <code>MEDIA_IMAGE_MAX_MB</code> (2), <code>MEDIA_GIF_MAX_MB</code> (8), <code>MEDIA_VIDEO_MAX_MB</code> (40), <code>MEDIA_VIDEO_MAX_SEC</code> (60), <code>MEDIA_GC_GRACE_DAYS</code> (14), <code>MEDIA_UPLOADS_PER_HOUR</code> (600 per profile), <code>MEDIA_MIN_FREE_MB</code> (512, <code>0</code> = no floor): photos and videos of custom exercises (tag <code>media</code>). Every MB here is 2^20 bytes.</li></ul>
</div>
<div class="ov">
<h3>Conventions</h3>
@@ -2657,7 +2657,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="ep-sum">Delete a user and everything of theirs</span>
</summary>
<div class="ep-body">
-<p>Removes the account for good: the user record, their passkeys, their push subscriptions, their live presence, their training history file, their uploaded photos and videos (<code>DATA_DIR/uploads/&lt;uid&gt;/</code>) and any Coach credential stored for them. Not reversible; <code>/api/admin/user/disable</code> is the reversible one. An admin cannot delete their own account, and the last admin cannot be deleted. Audited by name, since the id stops meaning anything.</p>
+<p>Removes the account for good: the user record, their passkeys, their push subscriptions, their live presence, their training history file, their uploaded photos and videos (<code>DATA_DIR/uploads/&lt;uid&gt;/</code>) and any Coach credential stored for them. Not reversible; <code>/api/admin/user/disable</code> is the reversible one. An admin cannot delete their own account, the last admin and the owner cannot be deleted, and only the owner deletes another admin. Audited by name, since the id stops meaning anything.</p>
<p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Admin only: a signed-in session whose user is an admin (<code>ADMIN_UIDS</code> or <code>admin:true</code>), as the session cookie or a Bearer token.</span></p>
<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
@@ -2675,7 +2675,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
</div>
<div class="prow rrow">
<span class="r-code s4">400</span>
- <span class="p-desc">Your own account, or the last admin.<span class="r-sig"><code>{&quot;error&quot;:&quot;you cannot delete your own account&quot;}</code></span></span>
+ <span class="p-desc">Your own account, the last admin, or the owner.<span class="r-sig"><code>{&quot;error&quot;:&quot;you cannot delete your own account&quot;}</code></span></span>
</div>
<div class="prow rrow">
<span class="r-code s4">401</span>
@@ -2693,6 +2693,99 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
</div>
</details>
+<details class="ep" id="op-adminUserRole">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/admin/user/role</code><span class="ep-chip admin">admin</span></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Owner: make someone an admin, or remove the role</span>
+ </summary>
+ <div class="ep-body">
+<p>Owner only (403 for any other admin). Not on the owner themselves, not on an admin named in <code>ADMIN_UIDS</code> (the server would restore them on restart), and a disabled account is enabled before it can be promoted. Removing the role keeps the account and its data.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Admin only: a signed-in session whose user is an admin (<code>ADMIN_UIDS</code> or <code>admin:true</code>), as the session cookie or a Bearer token.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
+ <div class="prow">
+ <span class="p-name">id<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string</span>
+ <span class="p-desc">The user id.</span>
+ </div>
+ <div class="prow">
+ <span class="p-name">admin<em class="p-req" title="required">required</em></span>
+ <span class="p-type">boolean</span>
+ <span class="p-desc"></span>
+ </div>
+</div>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Changed.<span class="r-sig">{ ok: always true, id: string, admin: boolean }</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">400</span>
+ <span class="p-desc">The owner, an <code>ADMIN_UIDS</code> admin, a disabled account, or no boolean.</span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">Signed in, but not an admin. The attempt is recorded in the audit log.<span class="r-sig"><code>{&quot;error&quot;:&quot;forbidden&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">404</span>
+ <span class="p-desc">No user with that id.</span>
+ </div>
+ </div>
+ </div>
+</details>
+
+<details class="ep" id="op-adminOwnerTransfer">
+ <summary>
+ <span class="m post">POST</span>
+ <span class="ep-path"><code>/api/admin/owner</code><span class="ep-chip admin">admin</span></span>
+ <span class="ep-chev" aria-hidden="true"></span>
+ <span class="ep-sum">Owner: hand the owner role to another admin</span>
+ </summary>
+ <div class="ep-body">
+<p>Owner only. The target must already be an enabled admin; the previous owner stays an admin.</p>
+ <p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Admin only: a signed-in session whose user is an admin (<code>ADMIN_UIDS</code> or <code>admin:true</code>), as the session cookie or a Bearer token.</span></p>
+
+<p class="ep-h">Request body <span class="p-hint">(JSON)</span></p><div class="ptab">
+ <div class="prow">
+ <span class="p-name">id<em class="p-req" title="required">required</em></span>
+ <span class="p-type">string</span>
+ <span class="p-desc">The user id.</span>
+ </div>
+</div>
+ <p class="ep-h">Responses</p>
+ <div class="ptab">
+ <div class="prow rrow">
+ <span class="r-code s2">200</span>
+ <span class="p-desc">Handed over.<span class="r-sig">{ ok: always true, id: string }</span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">400</span>
+ <span class="p-desc">Yourself, or not an enabled admin.</span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">401</span>
+ <span class="p-desc">No session, expired/revoked session, or a disabled account.<span class="r-sig"><code>{&quot;error&quot;:&quot;not signed in&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">403</span>
+ <span class="p-desc">Signed in, but not an admin. The attempt is recorded in the audit log.<span class="r-sig"><code>{&quot;error&quot;:&quot;forbidden&quot;}</code></span></span>
+ </div>
+ <div class="prow rrow">
+ <span class="r-code s4">404</span>
+ <span class="p-desc">No user with that id.</span>
+ </div>
+ </div>
+ </div>
+</details>
+
<details class="ep" id="op-adminInvites">
<summary>
<span class="m get">GET</span>
@@ -2854,10 +2947,10 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="m post">POST</span>
<span class="ep-path"><code>/api/admin/audit/clear</code><span class="ep-chip admin">admin</span></span>
<span class="ep-chev" aria-hidden="true"></span>
- <span class="ep-sum">Clear the activity log</span>
+ <span class="ep-sum">Owner: clear the activity log</span>
</summary>
<div class="ep-body">
-<p>Deletes the log file. The clear is itself the first event of the fresh log, and event ids are never reset, so a wipe always leaves a visible id gap.</p>
+<p>Owner only, so no other admin can erase a trace of what they did. Deletes the log file. The clear is itself the first event of the fresh log, and event ids are never reset, so a wipe always leaves a visible id gap.</p>
<p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Admin only: a signed-in session whose user is an admin (<code>ADMIN_UIDS</code> or <code>admin:true</code>), as the session cookie or a Bearer token.</span></p>
@@ -3316,6 +3409,11 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="p-type">string</span>
<span class="p-desc"></span>
</div>
+ <div class="prow">
+ <span class="p-name">owner</span>
+ <span class="p-type">boolean</span>
+ <span class="p-desc">Present (true) only for the instance owner.</span>
+ </div>
<div class="prow">
<span class="p-name">admin</span>
<span class="p-type">boolean</span>
@@ -4161,6 +4259,11 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="p-type">boolean</span>
<span class="p-desc"></span>
</div>
+ <div class="prow">
+ <span class="p-name">owner</span>
+ <span class="p-type">boolean</span>
+ <span class="p-desc">The one admin who manages the others.</span>
+ </div>
<div class="prow">
<span class="p-name">admin</span>
<span class="p-type">boolean</span>
@@ -4292,6 +4395,11 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<span class="p-type">boolean</span>
<span class="p-desc"></span>
</div>
+ <div class="prow">
+ <span class="p-name">user.owner</span>
+ <span class="p-type">boolean</span>
+ <span class="p-desc">The one admin who manages the others.</span>
+ </div>
<div class="prow">
<span class="p-name">user.admin</span>
<span class="p-type">boolean</span>