Skip to content

Commit 329f2f7

Browse files
feat(plugin-auth): remove a pending person and retry every environment-user host call from a durable outbox (#34162)
repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9 Fixes #33228 Clause-②: yes (widening) — added: `POST /api/v1/auth/admin/remove-sso-user` (platform administrators, cloud-managed environments only); an optional `userRemoved` member on `EnvironmentUserHost` and the `'removed'` value of `EnvironmentUserEventKind`; the `'deactivated'` value of the host outcome's `reason`. Nothing that was accepted is refused. Metadata-protocol: none ## 维护者速读 - **改了什么:** 云托管环境新增「删除待登录人员」接口 `POST /admin/remove-sso-user`:邮箱输错、从未登录的人可以直接删掉,同时通知云端取消其邀请;已停用的待登录人员被重新添加时不再给他发邀请。 - **为什么改:** 此前输错邮箱的待登录人员只能停用、删不掉。按裁决 A,本 PR 只保留删除接口和宿主接缝;邀请的可靠投递、重试和每人邀请状态由云端宿主自己负责,框架不再另建发件箱,避免两层各自重试、两张状态表互相矛盾。 - **风险与回滚:** 只在 `OS_CLOUD_MANAGED=1` 时生效,只能删「待登录」的人;新接口和宿主可选成员都是加法,没有新表、没有迁移。云端暂时连不上时删除会被拒绝(503,人员保留,稍后重试即可),不会出现「本地删了、云端邀请还在」的情况。回滚即 revert 本 PR。唯一的行为变化是停用中的待登录人员被重新添加时不再通知云端(答复里写明 `deactivated`)。 - **先看:** `packages/plugins/plugin-auth/src/pending-sso-users.ts` 的 `runRemoveSsoUser` / `takeBackPerson`(删除行时带「待登录」条件)/ `removalNotDone`(删除失败后的内联重新邀请),以及同文件 `addOnePendingPerson` 里停用判断那几行;其次 `environment-user-host.ts` 的 `hostMember` 回退。 - **两分钟验证:** `pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/pending-sso-users.test.ts`,预期 74 个测试全部通过。 - **需要你做的:** 无,席位落地(本 PR 767 行,低于 3000 行人合门槛,不触治理面)。 ## What changes Reshaped to ruling A on the card: the remove door and the host seam stay, and the framework keeps no outbox. Delivering a host call durably, and keeping each person's invitation status, is the host's job. **Remove door.** `POST /api/v1/auth/admin/remove-sso-user` with `{ "userId": "…" }`, gated for platform administrators exactly as `add-sso-user` is. - Off a cloud-managed environment it answers `409` and removes no one. - A person who is not pending answers `409` (deactivate them instead). This also holds at the removal itself. The person is re-checked inside the unit of work, and the `sys_user` delete carries `source: 'idp_pending'` in its `where` (a predicate delete, which honours `deleteBehavior` like the by-id one). A delete that removes no row throws inside the unit of work, so the child deletes roll back. A person whose first sign-in lands while the host is asked is kept with `409`, and the answer says the host was already told. - **One window stays open (objectstack#34373, an engine defect, no workaround here).** `sys_user` has cascading lookups. For such an object the engine reads the matching ids, walks the cascade, and then deletes `{ id: { $in } }` with no `source` predicate and no row lock. A first sign-in that commits between that read and that delete is still deleted and answered `200`. The docblocks, ledger note, docs and changeset all say so. - An unknown id answers `404`. A body with any key other than `userId` answers `400`. - The host is asked first, outside any transaction. Then the person's positions, permission sets, membership and row are removed in one unit of work, as the system. - The host is told through `userRemoved`. A host without that member is told through `userDeactivated` with `source: 'idp_pending'`, which by ruling already means "cancel the invitation". - A typed host refusal (403/409) answers with the host's own sentence, and no one is removed. - A host that cannot be reached refuses the removal, as it refuses a deactivation. The answer is `503 SERVICE_UNAVAILABLE` ("could not be reached … so they were not removed. Nothing was changed; try again."); the person is kept and no invitation is re-sent. The door calls the host once and keeps no record to ask again from, so removing the person would leave an invitation nothing could cancel. - With no host wired, the person is removed and the answer says `host: { notified: false, reason: 'no_host' }`. - A person other records still point at (`deleteBehavior: 'restrict'`) answers the engine's refusal, and no one is removed. When the host had already taken the cancellation and the person is still pending and not deactivated, the door sends the invitation again inline, once, through `userAdded`. The answer says whether that worked ("it was sent again", or "sending it again did not succeed, so they stay pending with no invitation: add them again"). Nothing is retried later. **A deactivated person is never sent an invitation** (review#1 S1, the in-door half). Re-adding a pending person who is deactivated no longer calls `userAdded`. The answer is `200 alreadyPending` with `host: { notified: false, reason: 'deactivated' }`. Reactivating them (`admin/unban-user`) is what tells the host again. A `banned` column read back as `true`, `1`, `'1'` or `'true'` counts as deactivated. **Host contract.** `EnvironmentUserHost` gains an optional `userRemoved(event)`, and `EnvironmentUserEventKind` gains `'removed'`. The seam's header now says each door calls the host once, and that a host which must not lose a call queues and retries it on its side. **Also.** - Auth route ledger row for the new door, plus the ledger-hygiene pin. - Both dogfood admin sweeps classify it (`admin-platform-admin-standing`, `admin-route-nonadmin-refusal`). - `content/docs/permissions/authentication.mdx` documents the door, the deactivated re-add, and what is the host's job (durable delivery, per-person status, treating a repeat as harmless, cancelling by `userId`, never by email address). **Dropped from the earlier head `3c25103f`** (ruling A): - `sys_environment_user_outbox` (object, platform-objects export, `platform-object-names.ts` row, cli ownership inventory row, tenancy census rows and census-page figures, the 21 generated translation files); - `environment-user-outbox.ts` (worker, lease, backoff, boot, accepted trigger) and its tests; - every outbox write in add, import, ban, unban and remove; - `deliveryId` on `EnvironmentUserEvent`; - the `invitation: { id, status }` answer fields; - the `opts.retried` argument of `notifyEnvironmentUserHost`; - the cli, spec and platform-objects changesets. Outside the files listed below, the tree is byte-identical to `main`. `admin-ban-endpoints.ts` and `manifest.ts` are back to main too. ## Tests `pending-sso-users.test.ts` (+16 tests, 74 in the file): - **Remove door:** - removes the row, grants and membership, and tells `userRemoved` first; - the `userDeactivated` fallback for a host without `userRemoved`; - a not-pending person gets `409`, no host is called, and no one is removed; - a typed host refusal leaves the person in place; - an unreachable host refuses the removal with `503`: the person is kept, the host is asked once, and nothing is re-sent; - `no_host`; - the `restrict` refusal re-invites inline through `userAdded`; - a re-invite the host does not take is answered truthfully; - `404`, `400` (missing id, unknown key) and `403` (non-admin); - the not-managed `409`. - **S1 and pending at the write:** - re-adding a deactivated pending person calls no `userAdded` and answers `deactivated`; - CONTROL: re-adding an active pending person invites again; - a refused removal of a deactivated pending person sends no new invitation; - a `banned` column read back as `'1'` or `'true'` is deactivated on a re-add; - a person who signs in while the host is asked is kept with `409`; - a person whose first sign-in lands inside the unit of work, after the pending read and before the row's delete, is kept with `409`, and their positions, permission sets and membership survive. The memory engine has no transaction, so the test gives it a snapshot `transaction`, which the plugin's `runAtomically` seam calls. The test asserts that the removal entered that seam once and that the child rows were restored when `NoLongerPending` was thrown. This proves the door's rollback path against the seam; on the real engine the window above still applies. Also: auth route ledger conformance, and the two dogfood admin sweeps. ## Acceptance notes - **Durable retry and per-person invitation status live in the host.** On a hosted environment that is cloud's `sys_env_member_request` (cloud PR #4594), which already handles invite / cancel / remove. A host that cannot be reached refuses the removal (`503`, nothing removed); the framework does not retry. Whether Setup → Users reads status through a host seam member or through cloud's table is decided on #33187, not here. - **Behaviour change on an existing door:** a re-add of a deactivated pending person used to call `userAdded`. It now calls nothing and answers `host.reason: 'deactivated'`. The request is not refused, and the answer gains a value (declared in the `Clause-②:` line). - **The pending check has a narrow open window on the real engine** (objectstack#34373). The engine's predicate delete on an object with cascading lookups re-deletes by id after the cascade walk, with no row lock, so a first sign-in that commits in that window is still removed. This is an engine defect, filed there, with no workaround in this PR. - **A person who signs in while the host is asked to cancel** is kept, but the host took the cancellation and no compensating call follows. Already routed to #34183, unchanged here. - **No explicit admin audit row for a removal.** The admin audit writer's union only takes create and update. The removal runs attributed to the administrator, so the engine's delete records who did it. review#1 escalated this as a follow-up card for the seat. - **No UI here.** No `sys_user` remove action. The Setup → Users column and button stay with #33186 / #33187. - **No new error code.** Refusals reuse `RESOURCE_CONFLICT`, `RESOURCE_NOT_FOUND`, `INVALID_REQUEST` and the host's own codes. ## Verification At head `2e868fa7e24` (origin/main `8436f67a2` merged at `1f1f43cbb`), heavy runs under the shared verify lock. - PR size against main: 11 files, +733 / −34 = **767 changed lines**, nothing generated. This is under the 3000-line human-merge threshold, and no governed surface is touched. <details><summary>Gates</summary> - Full derived run at `1f9b39d2606` (the previous head): `dispatch-gates --commands --repo objectstack-ai/objectstack` derived 108 families. Each ran with stdin from /dev/null and its exit code was captured before any pipe. 106 exited 0. `check:skill-examples` exited 3 (`client-react` not built), then 0 after a client-react build. `check:dual-build-cjs-loads` exited 3 (needs a repo-wide build) and was NOT MEASURED locally; `Lint & Repo Gates` ran it in CI and succeeded. `--ran` with `:: exit` codes: "108 derived famil(ies) accounted for — 107 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3)". - This round at `2e868fa7e24` changed only prose (a docblock, the ledger note, the docs paragraph and the changeset) and one test. Re-run locally: the gate subset that reads those files, 14 of 14 exit 0. They are `check:doc-authoring`, `check:auth-mount-ledger`, `check-affected-docs`, `check-drift-comment`, `check-empty-changeset`, `check-changeset-no-major`, `check:nul-bytes`, `check:issue-citations` (both forms), `check:docs-transcript-drift`, `check:doc-anchors`, `check:cross-package-test-inputs`, `check:engine-double-contract` and `check:closed-ceremony-text`. The full family set is declared to CI for this head. - PR check-runs on `2e868fa7e24` at write time: 33 success, 15 skipped, 4 in progress, none failed. `Lint & Repo Gates`, `TypeScript Type Check`, `Build Core`, `Check Changeset` and `Governed Surface Queue Guard` are success; `Test Core` was in progress. - Not run locally, left to CI: `pnpm lint`, `test:repo`, and the dogfood battery (the title has no `!` and `Clause-②:` has no narrowing arm). </details> <details><summary>Tests</summary> - `pnpm --filter @objectstack/plugin-auth test`: Test Files 279 passed (279), Tests 5667 passed | 10 skipped (5677). - `pnpm --filter @objectstack/plugin-auth typecheck`: exit 0. - `pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/pending-sso-users.test.ts`: 74 passed. </details> <details><summary>Ablations</summary> Each mutation went through `scripts/ablation-replace.mjs` in wrap mode (the anchor hit once and the mutation landed, verified against the blob). Each went red and was restored with blob == HEAD (the last two at `d2608bc280f4`) and an empty `git diff HEAD`. The suite imports source, so no `dist/` leg applies. - Row delete without the pending marker (`where: { id, source }` reduced to `where: { id }`): 1 failed (the in-unit sign-in case). Run at both `1f9b39d26` and `2e868fa7e`. - `takeBackPerson` run without its unit of work (`await (unit ? unit.runAtomically(work) : work())` reduced to `await work()`), at `2e868fa7e`: 1 failed, the in-unit case ("the removal ran inside the transactional seam: expected +0 to be 1"). - The unreachable-host refusal disabled: 1 failed ("a host that cannot be reached refuses the removal: 503"). - `isDeactivated` without the string forms: 1 failed ("a banned column read back as a string"). The first attempt was a no-op: `ablation-replace` refused it because the replacement (a bare semicolon) was not distinct, and nothing ran. It was redone with a distinct replacement. - The in-unit pending pre-read reduced to an existence check: 1 failed ("a person who signs in while the host is asked", whose membership assertion catches the child deletes the memory engine cannot roll back). - The `userDeactivated` fallback disabled in `hostMember`: 1 failed. - The S1 guard (`if (existing.deactivated)` made false): 2 failed (the re-add case and the string-forms case). - The inline re-invite disabled: 2 failed (the restrict re-invite case and the truthful-failure case). - The re-invite's deactivated check dropped: 1 failed ("a refused removal of a deactivated pending person sends no new invitation"). </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01Q4EjjPP1zuWBNq3nBXVei9)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 183a89e commit 329f2f7

11 files changed

Lines changed: 733 additions & 34 deletions
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'@objectstack/plugin-auth': patch
3+
---
4+
5+
feat(auth): a cloud-managed environment can remove a pending person, cancelling their invitation at the host
6+
7+
Clause-②: yes (widening) — added: `POST /api/v1/auth/admin/remove-sso-user` (platform administrators, cloud-managed environments only); an optional `userRemoved` member on the environment-user host contract and the `'removed'` event kind; the `'deactivated'` value of the host outcome's `reason`. Nothing that was accepted is refused.
8+
Metadata-protocol: none
9+
10+
On a cloud-managed environment, a person added to sign in through the hosting organisation's identity provider stays pending until their first sign-in. Before this change a pending person with a typo in their email could only be deactivated.
11+
12+
**Removing a pending person.** `POST /api/v1/auth/admin/remove-sso-user` with `{ "userId": "…" }` asks the host first, outside any transaction, then removes the person with their positions, permission sets and membership in one unit of work:
13+
14+
- The host is told through `userRemoved`. A host without it is told through `userDeactivated` with `source: 'idp_pending'`, which already means "cancel the invitation". A host should implement `userRemoved`.
15+
- A host refusal (403/409) answers with the host's sentence, and no one is removed.
16+
- A host that cannot be reached refuses the removal with `503 SERVICE_UNAVAILABLE`, and no one is removed: the door calls the host once and keeps no record to ask again from, so try again. Durable retry is the host's job.
17+
- With no host wired, the person is removed and the answer says `host: { notified: false, reason: 'no_host' }`.
18+
- A person who is not pending answers `409`: deactivate them instead. This holds at the removal itself: the person is re-checked inside the unit of work and the delete carries `source: 'idp_pending'`, so a person whose first sign-in lands while the host is asked is not removed. On an object with cascading lookups (such as `sys_user`) the engine re-deletes by id after the cascade, so a first sign-in committing in that narrow window is not yet refused.
19+
- A person that other records still point at (`deleteBehavior: 'restrict'`) answers the engine's refusal, and nothing is removed. If the host had already cancelled the invitation of a person who is still pending and not deactivated, the door sends it again through `userAdded`, once, and the answer says whether that worked.
20+
- An unknown id answers `404`; a body with any key but `userId` answers `400`. Off a cloud-managed environment the door answers `409` and removes no one.
21+
22+
**A deactivated person is never sent an invitation.** Adding a deactivated pending person again no longer calls `userAdded`; the answer says `host: { notified: false, reason: 'deactivated' }`. Reactivating them (`admin/unban-user`) is what tells the host again.
23+
24+
Nothing to migrate.

‎content/docs/permissions/authentication.mdx‎

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,8 @@ in the directory.
13161316

13171317
A host can be told about people as they come and go: the `environmentUserHost`
13181318
option of the auth plugin is called after a person is added, and before a
1319-
person is deactivated (`admin/ban-user`) or reactivated (`admin/unban-user`).
1319+
person is deactivated (`admin/ban-user`), reactivated (`admin/unban-user`) or,
1320+
while still pending, removed (`admin/remove-sso-user`).
13201321
It is never called inside a database transaction. Each event names the
13211322
administrator who acted, the administrator at the keyboard when the session
13221323
is an impersonation (`impersonatedBy`), and, when the acting administrator
@@ -1336,6 +1337,43 @@ reason }`. Adding a person who is still pending again tells the host again
13361337
and changes nothing else: positions, permission sets or a manager sent with
13371338
it are listed on the answer as `notApplied`; set them on the person's record.
13381339

1340+
A pending person who never signs in, for example one added with a mistyped
1341+
address, can be removed: `POST /api/v1/auth/admin/remove-sso-user` takes
1342+
`{ userId }`, removes the person with their positions, permission sets and
1343+
membership, and cancels their invitation at the host. The host is asked
1344+
first, through its `userRemoved` member; a host without that member is asked
1345+
through `userDeactivated` for the pending person instead, which means the same
1346+
thing, but a host should implement `userRemoved`. A host's refusal leaves the
1347+
person as they are. A host that cannot be reached refuses the removal too,
1348+
with `503` and nothing removed, as it refuses a deactivation: the door calls
1349+
the host once and keeps no record to ask again from, so try again once the
1350+
host is back. A person who is not pending (they have signed in, or were not
1351+
added this way) is refused with `409`: deactivate them instead. That holds at
1352+
the removal itself: the person is checked again inside the removal's unit of
1353+
work and the delete carries `source: 'idp_pending'`, so a person whose first
1354+
sign-in lands while the host is asked is not removed either, and the answer
1355+
says the host was already told. Because `sys_user` has cascading lookups, the
1356+
engine deletes the row by id after walking them, so a first sign-in that
1357+
commits in that narrow window is not yet refused. A record that
1358+
still points at the person through a lookup that restricts deletes refuses the
1359+
removal with that lookup's own answer, and nothing is removed; when the host
1360+
had already cancelled the invitation of a person who is still pending and not
1361+
deactivated, the door sends the invitation again through `userAdded`, once,
1362+
and the answer says whether that worked. Like the add doors, it is
1363+
platform-admin gated and answers `409` off a managed environment.
1364+
1365+
A deactivated person is never sent an invitation: adding a deactivated pending
1366+
person again calls no host and answers `host: { notified: false, reason:
1367+
'deactivated' }`; reactivating them is what tells the host again.
1368+
1369+
Each door calls the host once and keeps no record of the call. Delivering it
1370+
durably, and keeping each person's invitation status, is the host's job: a
1371+
host may queue and retry a call it could not complete. A call can reach a host
1372+
more than once (adding a person who is still pending again tells the host
1373+
again), so a host should treat a repeat as harmless, and should cancel an
1374+
invitation by the event's `userId`, never by its email address, which an
1375+
administrator may have typed wrong and may type again for someone else.
1376+
13391377
`admin/ban-user` and `admin/unban-user` work without the admin plugin: on a
13401378
deployment without it the ban is written by the platform, and a banned user is
13411379
refused a session with the same `403 BANNED_USER` answer the admin plugin

‎packages/plugins/plugin-auth/src/auth-plugin.ts‎

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,13 @@ export interface AuthPluginOptions extends Partial<AuthConfig> {
389389
* [#33181] The environment-user host (`environment-user-host.ts`): told
390390
* after a person is added through `admin/add-sso-user` or
391391
* `admin/import-sso-users`, and asked before a person is deactivated
392-
* through `admin/ban-user` or reactivated through `admin/unban-user`. Read
393-
* per call, so a host wired after boot is still found. A typed
394-
* `EnvironmentUserHostRefusal` refuses the operation (a refused add is
395-
* taken back out); any other failure refuses a deactivation (`503`) and is
396-
* reported on an add or a reactivation as `host: { notified: false,
397-
* reason }`, which it never undoes.
392+
* through `admin/ban-user`, reactivated through `admin/unban-user`, or a
393+
* pending person is removed through `admin/remove-sso-user` (`userRemoved`,
394+
* else `userDeactivated`). Read per call, so a host wired after boot is
395+
* still found. A typed `EnvironmentUserHostRefusal` refuses the operation
396+
* (a refused add is taken back out); any other failure refuses a
397+
* deactivation (`503`) and is reported on an add, a reactivation or a
398+
* removal as `host: { notified: false, reason }`, which it never undoes.
398399
*/
399400
environmentUserHost?: EnvironmentUserHostAccessor;
400401

@@ -5255,6 +5256,25 @@ export class AuthPlugin implements Plugin {
52555256
return c.json({ success: false, error: { code: 'INTERNAL_ERROR', message: INTERNAL_ERROR_MESSAGE } }, 500);
52565257
}
52575258
});
5259+
5260+
// Remove a person who is still pending (the email-typo case) and cancel
5261+
// their invitation at the host. Same gate and attribution as the two
5262+
// doors above; logic in `pending-sso-users.ts` (`runRemoveSsoUser`).
5263+
rawApp.post(`${basePath}/admin/remove-sso-user`, async (c: any) => {
5264+
try {
5265+
const actor = await gateAdmin(c);
5266+
if (actor instanceof Response) return actor;
5267+
const { runRemoveSsoUser } = await import('./pending-sso-users.js');
5268+
const { status, body } = await runAttributedToUser(actor, () =>
5269+
runRemoveSsoUser(pendingSsoUserDeps(c), actor, c.req.raw),
5270+
);
5271+
return c.json(body, status as any);
5272+
} catch (error) {
5273+
const err = error instanceof Error ? error : new Error(String(error));
5274+
ctx.logger.error('[AuthPlugin] admin/remove-sso-user failed', err);
5275+
return c.json({ success: false, error: { code: 'INTERNAL_ERROR', message: INTERNAL_ERROR_MESSAGE } }, 500);
5276+
}
5277+
});
52585278
}
52595279

52605280
// ────────────────────────────────────────────────────────────────────

‎packages/plugins/plugin-auth/src/auth-route-ledger.conformance.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ describe('auth route ledger hygiene', () => {
294294
// below holds it to the same proof — better-auth serves no roster.
295295
'POST /api/v1/auth/admin/list-platform-admins',
296296
'POST /api/v1/auth/admin/oauth2/toggle-disabled',
297+
// The pending-person remove door, on the same terms as the two above:
298+
// `auth-plugin.ts` mounts it itself (a `rawApp.post` on the
299+
// `${basePath}/admin/remove-sso-user` template); better-auth serves none.
300+
'POST /api/v1/auth/admin/remove-sso-user',
297301
// [#30958] On this pin's own terms: `auth-plugin.ts` mounts both itself
298302
// (`rawApp.post` on the `${basePath}/admin/scim/mint-credential` and
299303
// `${basePath}/admin/scim/revoke-credential` templates, ahead of the

‎packages/plugins/plugin-auth/src/auth-route-ledger.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,9 @@ export const AUTH_ROUTE_LEDGER: readonly AuthRouteLedgerEntry[] = [
260260
{ route: 'POST /api/v1/auth/admin/import-users', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — objectui app-shell\'s identity-import wizard (views/identityImport.ts) posts it directly from the Users list; platform-admin gated (ADR-0068). A dedicated identity-import door rather than the generic sys_user import, because a direct ObjectQL write would bypass better-auth\'s password hashing and mint no sys_account credential' },
261261
// #33181 — the tracker id stays HERE and never in the `note` string, per the
262262
// #16678 note below.
263-
{ route: 'POST /api/v1/auth/admin/add-sso-user', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — Setup → Users on a cloud-managed environment posts it; adds one person who signs in only through the hosting organisation identity provider: a sys_user row marked idp_pending (no password, refused a session) with optional positions, permission sets and manager, joined to the organization; 201, or 200 alreadyPending for a person already pending (the host is told again); 409 RESOURCE_CONFLICT off a managed environment or for an address already in use; closed body key set; the environment-user host is told after the write commits, and its answer rides host; platform-admin gated (ADR-0068)' },
263+
{ route: 'POST /api/v1/auth/admin/add-sso-user', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — Setup → Users on a cloud-managed environment posts it; adds one person who signs in only through the hosting organisation identity provider: a sys_user row marked idp_pending (no password, refused a session) with optional positions, permission sets and manager, joined to the organization; 201, or 200 alreadyPending for a person already pending (the host is told again, unless the person is deactivated: then host reads deactivated and nothing is sent); 409 RESOURCE_CONFLICT off a managed environment or for an address already in use; closed body key set; the environment-user host is told after the write commits, and its answer rides host; platform-admin gated (ADR-0068)' },
264264
{ route: 'POST /api/v1/auth/admin/import-sso-users', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — Setup → Users on a cloud-managed environment posts it; the CSV or JSON twin of admin/add-sso-user (columns email, name, positions, permission_sets, manager_id), at most 500 rows, each judged and written on its own so a bad row fails alone; answers a summary and one result per row; 409 RESOURCE_CONFLICT off a managed environment; platform-admin gated (ADR-0068)' },
265+
{ route: 'POST /api/v1/auth/admin/remove-sso-user', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — Setup → Users on a cloud-managed environment posts it; removes a person who is still pending (sys_user.source idp_pending: the email-typo case) with their positions, permission sets and membership, and cancels their invitation at the environment-user host (userRemoved, else userDeactivated), which is asked first so its typed refusal leaves the person as they are; a host that cannot be reached refuses it with 503 SERVICE_UNAVAILABLE and nothing is removed (the door calls the host once and keeps no record to retry from); the person is re-checked inside the unit of work and the row delete carries source idp_pending, so a person who signs in while the host is asked is kept with 409 (on an object with cascading lookups the engine re-deletes by id, so a first sign-in committing in that narrow window is not yet refused); a removal that fails after the host took the cancellation sends the invitation again once through userAdded and says so; body { userId }; 404 RESOURCE_NOT_FOUND for an unknown id; 409 RESOURCE_CONFLICT off a managed environment or for a person who is not pending; a lookup that restricts the delete refuses it with the engine answer; platform-admin gated (ADR-0068)' },
265266
{ route: 'POST /api/v1/auth/admin/list-platform-admins', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the sys_user list_platform_admins action posts it directly from the Users list; answers who holds platform-admin standing (the last-admin guard\'s enumerator, each id confirmed by hasPlatformAdminStanding), served only to a caller who holds that standing; reads no body. ADR-0095 D3' },
266267
{ route: 'POST /api/v1/auth/admin/oauth2/toggle-disabled', family: 'objectstack-mount', source: 'objectstack', disposition: 'server-only', note: 'no SDK method builds this URL — the sys_oauth_application disable/enable actions post it directly; ObjectStack mount closing a vendor gap (better-auth\'s /admin/oauth2/update-client strips `disabled` from its body schema), platform-admin gated (ADR-0068)' },
267268
// #30958 — the tracker id stays HERE and never in the `note` string, per the

0 commit comments

Comments
 (0)