feat(spec): declare requiredPermissions on BulkActionDefSchema (#6257) - #6332
Merged
baozhoutao merged 1 commit intoAug 7, 2026
Merged
Conversation
The selection bar has filtered buttons on def.requiredPermissions since objectui#3492, but the .strict() schema never declared the key, so no legal metadata could reach that filter — enforced ≠ declarable. The forms with no workaround were the inline data-plane defs (operation: 'update' | 'delete'): they dispatch no action, so unlike a def promoted from bulkActions: ['<name>'] they have nothing to inherit a gate from, and a declarative bulk delete stayed visible to every caller who could open the list, rejected only per record after the click. - BulkActionDefSchema: optional requiredPermissions: string[], with action.requiredPermissions semantics verbatim (absent/empty pass, entries AND, unresolvable caller capabilities fail open; on a data-plane def the gate governs visibility only — the write is still authorized by the data API). ActionSchema's near-miss aliases (permissions/capabilities/requiresPermissions/requiredCapabilities/acl) rename onto the key here too, and it joins the did-you-mean pool. - Regenerated authorable-surface/ui.json and the bulk-action reference page; new guide paragraph in content/docs/ui/views.mdx. - Showcase: the two inline gated defs the #6157 matrix could not pin, on showcase_project.default — relabel_ops (update + patch, gated on the Ops-held showcase.export_data) and purge_restricted (delete, gated on the granted-to-nobody showcase.restricted_ops) — plus a playwright spec pinning the admin-negative cells of the selection bar. - Schema tests: every def form accepts the gate, empty array and optionality pinned, non-array rejected, aliases rename. No renderer change: objectui's BulkActionDef type and BulkActionBar filter shipped in objectui 11 (objectui#3548). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PD7tZG1vENc5peMaLQC1uD
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 112 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
baozhoutao
deleted the
claude/issue-6257-bulk-action-required-permissions
branch
August 7, 2026 15:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6257(objectui 侧镜像单:objectstack-ai/objectui#3564)。
改了什么
BulkActionDefSchema增加可选requiredPermissions?: string[],语义与action.requiredPermissions逐字一致:缺省/空数组恒通过、多项取 AND、客户端解析不出调用者能力时 fail-open(服务端为准)。渲染层一行未动——objectui#3492 起BulkActionBar就在按这个键过滤,本单只是补上「合法写法」这一半(enforced ≠ declarable 的镜像缺口)。数据面 def(update/delete)上这个键只管显隐;写入本身仍由数据 API 的对象权限与服务端 hook 授权。配套(容易漏的 CI 门,均已过):
BULK_ACTION_DEF_KEYSdid-you-mean 键池加入新键;ActionSchema的近似拼写别名(permissions/capabilities/requiresPermissions/requiredCapabilities/acl)在本 schema 上同样重命名到位 ——alias-integrity全绿gen:schema产物authorable-surface/ui.json+gen:docs产物content/docs/references/ui/bulk-action.mdx已再生;check:generated10/10 全绿content/docs/ui/views.mdx补「Gating a def by capability」一段@objectstack/specminorshowcase 夹具(永久保留)
showcase_project.default补上 #6157 显隐矩阵钉不住的那一格——内联数据面 def 的能力门:relabel_ops—update+patch,门showcase.export_data(Ops 持有)purge_restricted—delete,门showcase.restricted_ops(特意无人持有,见security/capabilities.ts)另加
e2e/bulk-capability-gate.spec.ts(playwright),钉住 admin 负向两格:未加门 4 个按钮可见 + 两个带门按钮同时不可见。真机 UI 实测(console dev :5190 → showcase
--fresh:4010,admin 勾选全部 5 行)purge_restricted声明['showcase.restricted_ops']showcase_ops集showcase.export_data[]['showcase.restricted_ops']同一用户、同一批记录,只动声明或授权——门是活的,admin 也不豁免(能力门读的是授予,不是 admin 位),与 #6257 正文实测结论一致。
测试
@objectstack/spec全量 8500 passed (332 files),含新增 8 条 schema 测试(delete/update+patch/aggregate 三形态、AND、空数组、可选性、非数组拒绝、别名重命名)verify:validate ✓(rc.5 下同样写法硬失败Unrecognized key(s): requiredPermissions)+ typecheck ✓ + 146 passed (13 files)check:generated10/10 ✓,changed-files eslint ✓过程中记录的既有缺口(另开 issue,不在本 PR 修)
hono
current-user-endpoints的独立上下文解析器不读sys_user_position/sys_position_permission_set,岗位绑定的能力到不了/me/permissions(上面 ② 一步因此改用sys_user_permission_set用户直绑做正向对照)。随后以独立 issue 记录。🤖 Generated with Claude Code
https://claude.ai/code/session_01PD7tZG1vENc5peMaLQC1uD
Generated by Claude Code