fix(access): field-level permission editor now lists an object's published fields#2346
Merged
Conversation
…matrix
The Access pillar's field-level permission editor listed fields via
`client.list('field')`, which only surfaces standalone/code-package
field metadata. Fields carried inline on a published object were
missed, so the field-level section showed "No fields registered for
this object." even when GET /api/v1/meta/object/<name> returned a full
`fields` set — making field-level permissions unconfigurable in the UI.
Switch `ensureFields` to read the authoritative merged object
definition via `client.get('object', name)` — the same source the
object settings tab uses for its nameField dropdown — and handle both
the array and keyed-map shapes of `fields`. Expanding an object row now
lists its published fields with readable/editable toggles.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014TWMoRRb2y6R832sHpxhh3
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
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.
问题
ObjectStack Studio 的 Access 支柱(权限矩阵
PermissionMatrixEditor)里,展开某对象行配置字段级读写时,即使该对象已发布且有字段,也显示 "该对象未注册字段。" —— 导致字段级权限只能走 RESTPUT /api/v1/meta/permission/<name>,无法在 UI 里配置。根因
字段级编辑器的
ensureFields用client.list('field')枚举字段。该 LIST 端点只返回 standalone / 代码包的 field 元数据,拿不到已发布对象上内联携带(inline)的字段,于是对明明有字段的对象返回空列表 → 显示 "no fields"。而对象设置 tab(nameField 下拉)能正确列出全部字段,因为它读的是
client.get('object', name)返回的合并后对象定义(GET /api/v1/meta/object/<name>的权威fields)。两者数据源不一致。修复
packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.tsxensureFields改为读client.get('object', name)的合并定义 —— 与对象设置 tab 统一数据源。fields的两种形态:数组[{ name, label }]与键控 map{ [name]: def }。测试
PermissionMatrixEditor.scope.test.tsx新增回归用例:展开对象行后,断言其已发布字段(数组形态 + 键控 map 形态各一个对象)都能列出 readable/editable 勾选框,且不再出现 "No fields registered for this object."。vitest run PermissionMatrixEditor.scope.test.tsx→ 2 passedturbo run type-check --filter=@object-ui/app-shell→ 29/29 successful🤖 Generated with Claude Code
Generated by Claude Code