Skip to content

Commit 41ff7c3

Browse files
docs(spec): ban-user and unban-user no longer described as needing the admin plugin (#34119)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9XmUTbwghz9gpc54Frpqhjn)_ Fixes #34008 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:三处 spec 描述(`authFamilies.admin`、`features.admin`、`plugins.admin`)和 actions 文档示例不再说「停用/恢复、解锁、重设密码需要 admin 插件」,按实测列出真正依赖插件的操作;引用文档随之重新生成。 - 为什么改:停用/恢复、解锁、重设密码这四个接口是平台自带的,不装 admin 插件也能用;旧说法会让 AI 和开发者给这些按钮错误地加上 admin 门控。 - 风险与回滚:只改文字,没有任何 schema 接受或拒绝的结果变化;回滚即还原本 PR。 - 先看:`packages/spec/src/api/discovery.zod.ts`、`content/docs/protocol/objectui/actions.mdx`、`packages/spec/src/api/auth-endpoints.zod.ts`。 - 两分钟验证:`git grep -n "update-user, ban-user" -- packages/spec/src content/docs` 应无结果。 - 需要你做的:无,席位落地。 ## What changes - `AuthFamiliesSchema.admin` describe (`packages/spec/src/api/discovery.zod.ts`): the example family member `ban-user` is replaced by `impersonate-user`, and one sentence says `ban-user` and `unban-user` are not in the family: they are ObjectStack mounts, served whatever the flag says. Still one paragraph. - `features.admin` describe (`packages/spec/src/api/auth-endpoints.zod.ts`): creating and impersonating users are the operations that need the plugin; banning, unbanning, unlocking and setting a password answer without it, and the describe says the console still shows its unlock and set-password actions only when the flag is true. - `plugins.admin` describe and JSDoc (`packages/spec/src/system/auth-config.zod.ts`): the JSDoc lists the endpoints that need the plugin (`create-user`, which answers `501` without it, `impersonate-user` / `stop-impersonating`, `set-role`, `remove-user`, `GET list-users`, `list-user-sessions`, `revoke-user-session(s)`) apart from the four ObjectStack mounts served without it (`ban-user`, `unban-user`, `unlock-user`, `set-user-password`), described as mounts rather than the plugin's routes, with no claim about how they write. "better-auth enforces this internally" is replaced: the ObjectStack mounts, `create-user`, `remove-user` and the rebuilt `impersonate-user` run the ADR-0068 gate, the vendor routes keep better-auth's legacy `user.role` check, and `stop-impersonating` is neither: better-auth admits it on the impersonated session with the signed `admin_session` cookie `impersonate-user` set (read from `better-auth/dist/plugins/admin/routes.mjs` 1.7.12, which also declares `list-users` as `GET`). "assign global platform roles" is gone. The describe follows the same split. - `content/docs/protocol/objectui/actions.mdx`: the `requiresFeature: admin` worked example gates `impersonate_user` (`/api/v1/auth/admin/impersonate-user`) in place of `ban_user`. The second example (`disable_oauth_application`) is unchanged. - Regenerated: `content/docs/references/api/{discovery,protocol,auth-endpoints}.mdx`, `content/docs/references/system/auth-config.mdx` (`check:generated --fix`, which named only `check:docs` stale). - `.changeset/34008-ban-without-admin-plugin-prose.md`: `patch` on `@objectstack/spec`. ## Why The measurement, on `origin/main` at `27c2f1ea`. A throwaway probe (the `pending-sso-users.test.ts` harness, one platform admin, deleted after the run, not committed) fired each door with `plugins.admin` off and on: | door | off | on | |---|---|---| | `features.admin` | false | true | | `/admin/unlock-user` | 200 | 200 | | `/admin/set-user-password` | 200 | 200 | | `/admin/ban-user` | 200 | 200 | | `/admin/unban-user` | 200 | 200 | | `/admin/set-role` | 404 | 200 | | `/admin/create-user` | 501 `NOT_IMPLEMENTED` | 200 | | `/admin/impersonate-user` | 404 | 200 | Source reading: - `packages/plugins/plugin-auth/src/auth-plugin.ts`: `POST {basePath}/admin/ban-user` and `/admin/unban-user` are raw Hono mounts with no admin-plugin condition. Without the plugin, `getBanWriter` writes through the data engine (`isAdminPluginMounted()` false) and the session refusal enforces the ban. `pending-sso-users.test.ts` pins this ("a row banned while the admin plugin was on stays refused after the plugin is turned off", the ban / unban cases with the plugin off, and a CONTROL with it on). - `sys_user.ban_user` / `unban_user` carry no `requiresFeature`, and `PUBLIC_AUTH_FEATURES.admin.gatedInputs` (`packages/spec/src/kernel/public-auth-features.ts`) books neither, with a note saying why. - Routes that still answer 404 when `features.admin` is false: the better-auth vendor routes with no ObjectStack mount: `list-users`, `set-role`, `update-user`, `list-user-sessions`, `revoke-user-session(s)`, `stop-impersonating`, and `impersonate-user` (replaced on the admin plugin's own `endpoints` record by `admin-impersonate-endpoint.ts`, so it exists only with the plugin). The dogfood pin `discovery-auth-families.dogfood.test.ts` reads `GET /auth/admin/list-users` as 404 with the plugin off and not 404 with it on. `sys_user.impersonate_user` declares `requiresFeature: 'admin'`, which is why it is the docs example now. - ObjectStack mounts such as `create-user` stay mounted without the plugin but answer `501 NOT_IMPLEMENTED`; the describe's family list does not name them, so this PR does not touch that wording. ## Tests - `pnpm --filter @objectstack/spec test` at `6fe7a568`: Test Files 843 passed (843), Tests 26966 passed | 1 todo. Lock VERDICT command-exit 0. - No test edit was forced. No test pins the old wording (`git grep` of the three old phrases outside `packages/spec/src`, references and CHANGELOGs finds only the two out-of-scope copies listed below). - No ablation: prose only. ## Acceptance notes - Out of the card's paths, two copies of a related phrase, not changed here: - `packages/plugins/plugin-auth/src/auth-manager-plugin-list.ts:312`, a code comment "Platform admin: ban/unban, set-password, impersonate, set-role." beside the admin plugin's registration. With the plugin on, the vendor's ban hook still enforces, so it is loose rather than false. `domain:server`. - `docs/qa/platform-checklist/areas/identity-auth.json` item `identity-auth.admin-lifecycle-operations` title lists ban/unban among "admin user-lifecycle operations"; it makes no plugin claim. `domain:devx`. - `content/docs/releases/v18/18-5.mdx` and `packages/spec/CHANGELOG.md` keep their historical wording (release-owned). - `content/docs/permissions/authentication.mdx` already says ban / unban answer without `plugins.admin`; unchanged. - No `skills/**` file teaches the old rule (`git grep -n "ban-user\|ban_user\|unban" -- skills` is empty), so no skills follow-up. - The console's `sys_user.unlock_user` and `sys_user.set_user_password` declare `requiresFeature: 'admin'` (`packages/platform-objects/src/identity/sys-user.object.ts`) and `PUBLIC_AUTH_FEATURES.admin.gatedInputs` books both, while their doors answer 200 with the plugin off (probe above). On a deployment without the admin plugin the two buttons are hidden though the doors work: the same shape the ban / unban buttons had before PR #33989. Not changed here (platform-objects + kernel feature table); for the seat to file. The `features.admin` describe states the current console behaviour as it is. - File surface: the claim names `discovery.zod.ts` and `content/docs/**`; the delta also asks for other `packages/spec/**` copies, which added `auth-endpoints.zod.ts` and `auth-config.zod.ts`. ## Verification <details><summary>Derived gates at 6fe7a56: 104 derived, 103 run green, 1 NOT MEASURED</summary> - `node scripts/pm/dispatch-gates.mjs --ran` on the final record: "104 derived famil(ies) accounted for — 103 run, 1 NOT-MEASURED". - NOT MEASURED: `pnpm check:dual-build-cjs-loads` exit 3, PREREQUISITE NOT MET (reads every package's `dist/`; this container built only the spec, lint and client-react closures). CI runs it. - Every derived gate ran once at `6fe7a568`, with `NODE_OPTIONS=--max-old-space-size=4096` exported for the whole run, and all 103 exited 0 on that first run. Earlier heads needed reruns: at `97b9f14c`, `spec check:generated` ran its `check:test-typecheck` `tsc` out of heap without that flag; at `36887238`, `check-plugin-teardown-shape.mjs --self-test` needed its pinned fixture commit fetched into the shallow clone. - Record: project share `spec-seat2/34008-gates-ran-r3.txt`. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmNsjxB7oSL12vpVvW6 <!-- signed: domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 75ab117 commit 41ff7c3

9 files changed

Lines changed: 52 additions & 25 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
docs(spec): the admin-plugin descriptions no longer say ban, unban, unlock and set-password need the plugin
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`POST {routes.auth}/admin/ban-user`, `/admin/unban-user`, `/admin/unlock-user` and `/admin/set-user-password` are ObjectStack mounts, served whether or not the better-auth admin plugin is on. Three descriptions still said otherwise, and now say this:
11+
12+
- `AuthFamiliesSchema.admin` (`@objectstack/spec/api`, served as `authFamilies.admin` on discovery): the family whose routes answer a plain `404` when the flag is false is `list-users`, `set-role`, `update-user`, `impersonate-user` and the other better-auth routes. `ban-user` and `unban-user` are not in it.
13+
- `features.admin` on `GET {routes.auth}/config`: creating and impersonating users are the operations that need the plugin. Banning, unbanning, unlocking and setting a password answer without it (the console still shows its unlock and set-password actions only when the flag is true).
14+
- `plugins.admin` in the auth config: its description and JSDoc list what needs the plugin (`create-user`, which answers `501` without it, impersonation and the vendor routes such as `set-role` and `list-users`) apart from the ObjectStack mounts served without it (`ban-user`, `unban-user`, `unlock-user`, `set-user-password`). The JSDoc no longer says better-auth enforces the admin check on every route: the ObjectStack mounts, `create-user`, `remove-user` and `impersonate-user` run the ADR-0068 platform-admin gate, the vendor routes keep better-auth's legacy-role check, and `stop-impersonating` is admitted on the impersonated session with its signed `admin_session` cookie.
15+
16+
The `requiresFeature` example in the actions guide gates `impersonate_user` on `admin`, in place of `ban_user`. Nothing a schema accepts or refuses changes.

‎content/docs/protocol/objectui/actions.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,10 @@ When an action (or param) only works with an opt-in auth capability behind it
410410

411411
```yaml
412412
# Hidden entirely when the admin plugin is off (instead of a button that 404s)
413-
name: ban_user
414-
label: Ban User
413+
name: impersonate_user
414+
label: Impersonate User
415415
type: api
416-
target: /api/v1/auth/admin/ban-user
416+
target: /api/v1/auth/admin/impersonate-user
417417
requiresFeature: admin
418418
419419
# Composes with a residual row predicate:

‎content/docs/references/api/auth-endpoints.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const result = AuthEndpointSchema.parse(data);
7676
| **degradedTenancy** | `boolean` | optional | Degraded tenancy: true when multi-organization isolation was requested but is not active (the deployment booted only because OS_ALLOW_DEGRADED_TENANCY=1), so no engine enforces organization boundaries; the console can raise an operator warning off it. A status signal, not a capability gate; absent means not degraded |
7777
| **oidcProvider** | `boolean` | optional | Embedded OIDC authorization server wired, from the same decision that mounts it, so OAuth applications can be registered and managed; on by default alongside the MCP surface. It says nothing about sign-in providers, which socialProviders lists; the flag is default-on, so absent reads as on |
7878
| **deviceAuthorization** | `boolean` | optional | Device authorization (browser-approved CLI login) wired, so the device-code endpoints answer; when false the console device-approval page says device authorization is not enabled instead of calling them. Absent means not wired |
79-
| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, banning, unlocking and impersonating users, setting their passwords) is available; the console shows those actions only when it is true. Absent means not wired |
79+
| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so creating and impersonating users is available; the console shows those actions only when it is true. Banning, unbanning, unlocking and setting a password answer without it; the console still shows its unlock and set-password actions only when it is true. Absent means not wired |
8080
| **termsUrl** | `string` | optional | Terms-of-service link shown beneath the login and register cards: the trimmed OS_TERMS_URL value when set, otherwise the public ObjectStack terms page; absent when the operator set OS_TERMS_URL to an empty or blank (whitespace-only) value to suppress the link |
8181
| **privacyUrl** | `string` | optional | Privacy-policy link shown beneath the login and register cards: the trimmed OS_PRIVACY_URL value when set, otherwise the public ObjectStack privacy page; absent when the operator set OS_PRIVACY_URL to an empty or blank (whitespace-only) value to suppress the link |
8282

@@ -227,7 +227,7 @@ This schema accepts one of the following structures:
227227
| **degradedTenancy** | `boolean` | optional | Degraded tenancy: true when multi-organization isolation was requested but is not active (the deployment booted only because OS_ALLOW_DEGRADED_TENANCY=1), so no engine enforces organization boundaries; the console can raise an operator warning off it. A status signal, not a capability gate; absent means not degraded |
228228
| **oidcProvider** | `boolean` | optional | Embedded OIDC authorization server wired, from the same decision that mounts it, so OAuth applications can be registered and managed; on by default alongside the MCP surface. It says nothing about sign-in providers, which socialProviders lists; the flag is default-on, so absent reads as on |
229229
| **deviceAuthorization** | `boolean` | optional | Device authorization (browser-approved CLI login) wired, so the device-code endpoints answer; when false the console device-approval page says device authorization is not enabled instead of calling them. Absent means not wired |
230-
| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, banning, unlocking and impersonating users, setting their passwords) is available; the console shows those actions only when it is true. Absent means not wired |
230+
| **admin** | `boolean` | optional | Admin plugin wired (forced on whenever SCIM is enabled), so creating and impersonating users is available; the console shows those actions only when it is true. Banning, unbanning, unlocking and setting a password answer without it; the console still shows its unlock and set-password actions only when it is true. Absent means not wired |
231231
| **termsUrl** | `string` | optional | Terms-of-service link shown beneath the login and register cards: the trimmed OS_TERMS_URL value when set, otherwise the public ObjectStack terms page; absent when the operator set OS_TERMS_URL to an empty or blank (whitespace-only) value to suppress the link |
232232
| **privacyUrl** | `string` | optional | Privacy-policy link shown beneath the login and register cards: the trimmed OS_PRIVACY_URL value when set, otherwise the public ObjectStack privacy page; absent when the operator set OS_PRIVACY_URL to an empty or blank (whitespace-only) value to suppress the link |
233233

‎content/docs/references/api/discovery.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Which optional better-auth route families are mounted under routes.auth
5757

5858
| Property | Type | Required | Description |
5959
| :--- | :--- | :--- | :--- |
60-
| **admin** | `boolean` | ✅ | Whether the better-auth admin family (`{routes.auth}`/admin/*: list-users, set-role, update-user, ban-user, …) is mounted. Same value as features.admin on GET `{routes.auth}`/config, read from the same source; false means those routes answer a plain 404 on this deployment. |
60+
| **admin** | `boolean` | ✅ | Whether the better-auth admin family (`{routes.auth}`/admin/*: list-users, set-role, update-user, impersonate-user, …) is mounted. Same value as features.admin on GET `{routes.auth}`/config, read from the same source; false means those routes answer a plain 404 on this deployment. ban-user and unban-user are not in the family: they are ObjectStack mounts, served whatever this says. |
6161

6262

6363
---
@@ -166,7 +166,7 @@ Which optional better-auth route families are mounted under routes.auth
166166

167167
| Property | Type | Required | Description |
168168
| :--- | :--- | :--- | :--- |
169-
| **admin** | `boolean` | ✅ | Whether the better-auth admin family (`{routes.auth}`/admin/*: list-users, set-role, update-user, ban-user, …) is mounted. Same value as features.admin on GET `{routes.auth}`/config, read from the same source; false means those routes answer a plain 404 on this deployment. |
169+
| **admin** | `boolean` | ✅ | Whether the better-auth admin family (`{routes.auth}`/admin/*: list-users, set-role, update-user, impersonate-user, …) is mounted. Same value as features.admin on GET `{routes.auth}`/config, read from the same source; false means those routes answer a plain 404 on this deployment. ban-user and unban-user are not in the family: they are ObjectStack mounts, served whatever this says. |
170170

171171

172172
---

‎content/docs/references/api/protocol.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ This schema accepts one of the following structures:
11771177

11781178
| Property | Type | Required | Description |
11791179
| :--- | :--- | :--- | :--- |
1180-
| **admin** | `boolean` | ✅ | Whether the better-auth admin family (`{routes.auth}`/admin/*: list-users, set-role, update-user, ban-user, …) is mounted. Same value as features.admin on GET `{routes.auth}`/config, read from the same source; false means those routes answer a plain 404 on this deployment. |
1180+
| **admin** | `boolean` | ✅ | Whether the better-auth admin family (`{routes.auth}`/admin/*: list-users, set-role, update-user, impersonate-user, …) is mounted. Same value as features.admin on GET `{routes.auth}`/config, read from the same source; false means those routes answer a plain 404 on this deployment. ban-user and unban-user are not in the family: they are ObjectStack mounts, served whatever this says. |
11811181

11821182

11831183
---

‎content/docs/references/system/auth-config.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Advanced / low-level Better-Auth options
104104
| **oidcProvider** | `boolean` | optional (default: `false`) | Enable the OpenID Connect provider plugin (acts as an OIDC IdP) |
105105
| **dynamicClientRegistration** | `boolean` | optional | Allow unauthenticated RFC 7591 Dynamic Client Registration (default: follows OS_MCP_SERVER_ENABLED) |
106106
| **deviceAuthorization** | `boolean` | optional (default: `false`) | Enable RFC 8628 Device Authorization Grant (CLI / TV-style login) |
107-
| **admin** | `boolean` | optional | Enable platform admin operations (ban/unban, set-password, impersonate, set-role). Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside effective SCIM is a conflict refused at construction time. |
107+
| **admin** | `boolean` | optional | Enable the better-auth admin plugin: create-user, impersonation and the vendor admin routes (set-role, list-users, …). Ban/unban, unlock and set-password are served without it. Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside effective SCIM is a conflict refused at construction time. |
108108
| **phoneNumber** | `boolean` | optional (default: `false`) | Enable phone-number sign-in (phone + password; OTP sign-in/reset when an SMS service is configured) |
109109
| **scim** | `boolean` | optional | Enable the SCIM 2.0 provisioning surface. Unset: OS_SCIM_ENABLED decides (absent = off); an explicit value wins over the env var. Effective SCIM forces the admin plugin on when admin is unset; an explicit admin: false beside effective SCIM is refused at construction time. |
110110
| **sso** | `boolean` | optional | Enable enterprise SSO (domain-routed OIDC/SAML sign-in). Unset: OS_SSO_ENABLED decides (absent = off); an explicit value wins over the env var. |
@@ -214,7 +214,7 @@ OIDC / Generic OAuth2 provider configuration for enterprise SSO
214214
| **oidcProvider** | `boolean` | optional (default: `false`) | Enable the OpenID Connect provider plugin (acts as an OIDC IdP) |
215215
| **dynamicClientRegistration** | `boolean` | optional | Allow unauthenticated RFC 7591 Dynamic Client Registration (default: follows OS_MCP_SERVER_ENABLED) |
216216
| **deviceAuthorization** | `boolean` | optional (default: `false`) | Enable RFC 8628 Device Authorization Grant (CLI / TV-style login) |
217-
| **admin** | `boolean` | optional | Enable platform admin operations (ban/unban, set-password, impersonate, set-role). Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside effective SCIM is a conflict refused at construction time. |
217+
| **admin** | `boolean` | optional | Enable the better-auth admin plugin: create-user, impersonation and the vendor admin routes (set-role, list-users, …). Ban/unban, unlock and set-password are served without it. Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside effective SCIM is a conflict refused at construction time. |
218218
| **phoneNumber** | `boolean` | optional (default: `false`) | Enable phone-number sign-in (phone + password; OTP sign-in/reset when an SMS service is configured) |
219219
| **scim** | `boolean` | optional | Enable the SCIM 2.0 provisioning surface. Unset: OS_SCIM_ENABLED decides (absent = off); an explicit value wins over the env var. Effective SCIM forces the admin plugin on when admin is unset; an explicit admin: false beside effective SCIM is refused at construction time. |
220220
| **sso** | `boolean` | optional | Enable enterprise SSO (domain-routed OIDC/SAML sign-in). Unset: OS_SSO_ENABLED decides (absent = off); an explicit value wins over the env var. |

‎packages/spec/src/api/auth-endpoints.zod.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ export const AuthFeaturesConfigSchema = lazySchema(() => z.object({
366366
+ 'Absent means not wired',
367367
),
368368
admin: z.boolean().optional().describe(
369-
'Admin plugin wired (forced on whenever SCIM is enabled), so user administration (creating, banning, unlocking and impersonating users, setting their passwords) is available; '
370-
+ 'the console shows those actions only when it is true. Absent means not wired',
369+
'Admin plugin wired (forced on whenever SCIM is enabled), so creating and impersonating users is available; the console shows those actions only when it is true. '
370+
+ 'Banning, unbanning, unlocking and setting a password answer without it; the console still shows its unlock and set-password actions only when it is true. Absent means not wired',
371371
),
372372
termsUrl: z.string().optional().describe(
373373
'Terms-of-service link shown beneath the login and register cards: the trimmed OS_TERMS_URL value when set, otherwise the public ObjectStack terms page; absent when the operator set OS_TERMS_URL to an empty or blank (whitespace-only) value to suppress the link',

‎packages/spec/src/api/discovery.zod.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,10 @@ export function readChannelRoute(svc: unknown): string | undefined {
287287
*/
288288
export const AuthFamiliesSchema = lazySchema(() => z.object({
289289
admin: z.boolean().describe(
290-
'Whether the better-auth admin family ({routes.auth}/admin/*: list-users, set-role, update-user, ban-user, …) '
290+
'Whether the better-auth admin family ({routes.auth}/admin/*: list-users, set-role, update-user, impersonate-user, …) '
291291
+ 'is mounted. Same value as features.admin on GET {routes.auth}/config, read from the same source; '
292-
+ 'false means those routes answer a plain 404 on this deployment.'
292+
+ 'false means those routes answer a plain 404 on this deployment. ban-user and unban-user are not in the family: '
293+
+ 'they are ObjectStack mounts, served whatever this says.'
293294
),
294295
}).describe('Which optional better-auth route families are mounted under routes.auth'));
295296

‎packages/spec/src/system/auth-config.zod.ts‎

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,34 @@ export const AuthPluginConfigSchema = lazySchema(() => z.object({
7878
'Enable RFC 8628 Device Authorization Grant (CLI / TV-style login)',
7979
),
8080
/**
81-
* Enable better-auth's `admin` plugin so platform admins can ban / unban
82-
* users, set their password (out-of-band recovery), impersonate them for
83-
* support sessions, and assign global platform roles.
81+
* Enable better-auth's `admin` plugin so platform admins can create users,
82+
* impersonate them for support sessions, and reach better-auth's own admin
83+
* routes (`set-role`, `list-users`, …).
8484
*
85-
* Endpoints exposed under the auth route:
86-
* - `POST /admin/ban-user` / `POST /admin/unban-user`
87-
* - `POST /admin/set-user-password`
85+
* Endpoints under the auth route that need it:
86+
* - `POST /admin/create-user` (answers `501 NOT_IMPLEMENTED` without it)
8887
* - `POST /admin/impersonate-user` / `POST /admin/stop-impersonating`
8988
* - `POST /admin/set-role`
90-
* - `POST /admin/create-user` / `POST /admin/remove-user`
91-
* - `POST /admin/list-users` / `POST /admin/list-user-sessions`
89+
* - `POST /admin/remove-user`
90+
* - `GET /admin/list-users` / `POST /admin/list-user-sessions`
9291
* - `POST /admin/revoke-user-session(s)`
9392
*
93+
* Served with the plugin off as well as on, as ObjectStack mounts rather
94+
* than the plugin's own routes: `POST /admin/ban-user` /
95+
* `POST /admin/unban-user`, `POST /admin/unlock-user` and
96+
* `POST /admin/set-user-password`.
97+
*
9498
* The plugin augments `sys_user` with `role`, `banned`, `ban_reason`,
9599
* `ban_expires` and `sys_session` with `impersonated_by`. These columns
96100
* are mapped to snake_case by `buildAdminPluginSchema()`.
97101
*
98-
* Only callers whose user has a platform admin role (default: `admin`)
99-
* can hit these endpoints; better-auth enforces this internally.
102+
* The ObjectStack mounts, `create-user`, `remove-user` and the rebuilt
103+
* `impersonate-user` run the ADR-0068 platform-admin gate; the vendor routes
104+
* left as better-auth ships them (`set-role`, `list-users`, …) keep
105+
* better-auth's own check of the legacy `user.role` scalar. The exception is
106+
* `stop-impersonating`, which is neither: better-auth admits it on the
107+
* impersonated session together with the signed `admin_session` cookie
108+
* that `impersonate-user` set.
100109
*
101110
* Tri-state on purpose (#13816, maintainer ruling 2026-09-01): when left
102111
* UNSET, effective SCIM decides — SCIM provisioning forces the admin
@@ -110,7 +119,8 @@ export const AuthPluginConfigSchema = lazySchema(() => z.object({
110119
* admin plugin, or disable SCIM.
111120
*/
112121
admin: z.boolean().optional().describe(
113-
'Enable platform admin operations (ban/unban, set-password, impersonate, set-role). ' +
122+
'Enable the better-auth admin plugin: create-user, impersonation and the vendor admin routes (set-role, list-users, …). ' +
123+
'Ban/unban, unlock and set-password are served without it. ' +
114124
'Unset: forced on by effective SCIM (ADR-0134), otherwise off. An explicit false beside ' +
115125
'effective SCIM is a conflict refused at construction time.',
116126
),

0 commit comments

Comments
 (0)