Repository navigation
Commit 41ff7c3
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
- .changeset
- content/docs
- protocol/objectui
- references
- api
- system
- packages/spec/src
- api
- system
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
413 | | - | |
414 | | - | |
| 413 | + | |
| 414 | + | |
415 | 415 | | |
416 | | - | |
| 416 | + | |
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
| 230 | + | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1177 | 1177 | | |
1178 | 1178 | | |
1179 | 1179 | | |
1180 | | - | |
| 1180 | + | |
1181 | 1181 | | |
1182 | 1182 | | |
1183 | 1183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
370 | | - | |
| 369 | + | |
| 370 | + | |
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
| 290 | + | |
291 | 291 | | |
292 | | - | |
| 292 | + | |
| 293 | + | |
293 | 294 | | |
294 | 295 | | |
295 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
84 | 84 | | |
85 | | - | |
86 | | - | |
87 | | - | |
| 85 | + | |
| 86 | + | |
88 | 87 | | |
89 | 88 | | |
90 | | - | |
91 | | - | |
| 89 | + | |
| 90 | + | |
92 | 91 | | |
93 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
94 | 98 | | |
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
98 | | - | |
99 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
100 | 109 | | |
101 | 110 | | |
102 | 111 | | |
| |||
110 | 119 | | |
111 | 120 | | |
112 | 121 | | |
113 | | - | |
| 122 | + | |
| 123 | + | |
114 | 124 | | |
115 | 125 | | |
116 | 126 | | |
| |||
0 commit comments