feat: gate detail/form edit & delete on the server's effective operation set (#3546) - #2832
Merged
Merged
Conversation
Extend the #3391 PR-4 effective-operation intersection from the list/toolbar
surface to the detail/form surfaces, so a record page and its forms never offer
an edit/delete/create operation the server would 405.
- core: isObjectInlineEditable(obj, effectiveApiOperations?) gains the same
optional 2nd arg as resolveCrudAffordances — inline-edit ANDs with server
`update`.
- app-shell RecordDetailView: thread effective ops into the synthesized
Edit/Delete header actions and the record-body inline-edit `canEdit` gate.
- app-shell RelatedRecordActionsBridge: intersect each child object's
Create/Edit/Delete handlers with that child's own effective set.
- plugin-detail record:details: AND inline-edit with effective `update`.
- plugin-form ObjectForm: blanket managed-object field lock also engages when
the server denies `update` (edit) / `create` (create).
Backward-compatible: missing effective set (unrestricted / old backend / no
PermissionProvider) leaves the bucket+userActions decision untouched. Layers on
top of the existing check('edit')/check('delete') gates (intersection).
Tests: core isObjectInlineEditable effective-ops cases; a RelatedRecordActions
Bridge component test asserting Create/Edit/Delete button visibility under
full-CRUD / read-only / update-only / undefined effective sets.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012L8EfEa157Pe6C73qRnaJH
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
os-zhuang
marked this pull request as ready for review
July 27, 2026 05:49
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.
背景
框架 #3391 的独立 follow-up ③(前端,objectui 仓;对应 objectstack#3546)。
PR-4(objectui#2823)让列表/工具栏面(
ObjectViewImport、ListView/ObjectGridExport)接入了服务端下发的 effective 操作集(/me/permissions的apiOperations,经resolveCrudAffordances(obj, effectiveApiOperations?)第二参交集)。detail / form 面的 edit/delete 此前仍只按resolveCrudAffordances(obj)(bucket +userActions)判定,不与服务端 effective 集交集。本 PR 把同一交集扩展到 detail/form 面,使记录页及其表单永不提供服务端会 405 的 edit/delete/create。改动
isObjectInlineEditable(obj, effectiveApiOperations?)获得与resolveCrudAffordances相同的可选第二参 —— inline-edit 现在额外与服务端update取交集。RecordDetailView把该对象的 effective 操作集传入 header 合成的 Edit/Delete 动作与记录体 inline-edit 门(canEdit);RelatedRecordActionsBridge把每个子对象的 Create/Edit/Delete handler 与该子对象自身的 effective 集取交集。record:details的 inline-edit 与 effectiveupdate取交集。ObjectForm的托管对象整表字段锁,在服务端拒绝update(edit 模式)/create(create 模式)时同样生效。契约 / 兼容
向后兼容:effective 集缺失(全开对象、旧后端、或未挂
PermissionProvider)时,保持 bucket +userActions的判定不变(即今天的行为)。叠加在既有的 per-objectcheck('edit')/check('delete')权限门之上(取交集,永不取并集)。测试
isObjectInlineEditable的 effective-ops 用例:含/不含update、空集、undefined回退、bucket 已禁则服务端授权也不再开启。RelatedRecordActionsBridge组件测试:在 full-CRUD / read-only / update-only / undefined 四种 effective 集下断言 Create/Edit/Delete 按钮的显隐。record-details/ObjectForm.managedEdit/crudAffordances套件回归通过;core / plugin-detail / plugin-form / app-shell 构建(tsc + dts)全绿。关联
🤖 Generated with Claude Code
https://claude.ai/code/session_012L8EfEa157Pe6C73qRnaJH
Generated by Claude Code