Skip to content

fix(console): offer view management on manage_metadata, not isAdmin alone - #36782

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-ik9gua
Nov 23, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-ik9gua

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Fixes #36448

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:没有「管理元数据」权限的组织管理员,在列表页不再看到「管理视图」「视图设置」「新建视图」,数据页也不再有「另存为视图」;有该权限的管理员看到的和以前一样。
  • 为什么做:这几个入口保存的都是共享视图定义,服务器只接受有「管理元数据」权限的人;以前只看是不是管理员,没权限的管理员点进去一保存就被拒。紧接上一张「只有元数据管理员能建共享视图」的卡。
  • 出错会怎样:最坏是有权限的管理员看不到入口(纯界面开关,服务器规则没动),撤回这个改动即恢复。
  • 要你做什么:无。

What changes

One answer gates every entry on a list page that leads to a view metadata write: mayManageViews(isAdmin, useCanAuthorMetadata()) — an administrator whose session holds manage_metadata, the capability PUT/DELETE /meta/view/NAME asks (metaWriteCapabilityVerdict). It is the predicate #36398 introduced for the Shared choice (mayShareViews), renamed because it now gates more than sharing.

  • ObjectView computes canManageViews once and reads it for: the ManageViewsDialog mount, the ViewConfigPanel open state and wrapper, the CreateViewDialog open state, the title switcher's Add view / Manage views entries (useObjectViewTitleSwitcher prop isAdmin becomes canManageViews), and the plugin view's allowCreateView and viewActions (settings, share, delete) (useObjectViewPluginSchema, same rename).
  • ObjectDataPage's Save as view (button, folded menu item and its CreateViewDialog) — a fourth Create View door, writing /meta/view through createRuntimeMetadata — reads the same predicate.
  • Declared bounded in-place fix (same defect class, same file, same gate family; named in the thread's first report to the seat): a saved shared view's Rename in the Options menu and Save to this view (canSaveToSharedView) both write /meta/view through updateView and were offered on isAdmin alone; they read canManageViews too.
  • isAdmin alone still gates what only reads (the metadata inspector panel, the package-list reads behind the panel's read-only state).

A reader's own views (sys_personal_view) are untouched: the in-place Add view still offers My view to everyone who may create one.

Tests

  • New ObjectView.viewManagementGate-36448.test.tsx: the real ObjectView under the router; an organization administrator without manage_metadata gets no Manage views entry (and no dialog); one with it opens Manage views and Create View from it (control); a member gets neither. The plugin schema: without the capability allowCreateView is false and viewActions empty; with it, both offered (control).
  • ObjectDataPage.saveAsViewRefusal-11578.test.tsx: new top-level describe in the existing harness — Save as view (button, menu item, dialog) absent without the capability, present with it (control); the existing cases now set the capability explicitly.
  • objectViewViewSharing.test.tsx and objectViewRecordNavigation.phonePush-29074.test.tsx follow the rename.

Acceptance notes

  • none

Verification

Two-minute check: sign in as an organization administrator who lacks manage_metadata, open any object list — the view switcher shows no Manage views and the data page no Save as view; as a metadata administrator both are there.

Riskiest hunks to read first: ObjectView.tsx (the canManageViews line and the three JSX gates), objectViewPluginSchema.ts (allowCreateView / viewActions), ObjectDataPage.tsx (canSaveAsView).

Readings at head 10d4f44
  • Targeted tests: pnpm --dir ui exec vitest run on ObjectView.viewManagementGate-36448.test.tsx, ObjectDataPage.saveAsViewRefusal-11578.test.tsx, objectViewViewSharing.test.tsx, objectViewRecordNavigation.phonePush-29074.test.tsx — Test Files 4 passed (4), Tests 26 passed (26) (lock VERDICT command-exit 0), after pnpm --filter '@object-ui/app-shell^...' build (exit 0).
  • Reverse verification (implementation committed first): the five source files restored to e0f0e9f7 with the new tests kept — 4 of 10 cases RED: the three without-capability cases (Manage views offered, Save as view offered, plugin Create View and view actions offered) as predicted, plus the plugin-schema control, which goes red because the old hook takes isAdmin, not canManageViews (the rename, not the gate). Restored with git checkout HEAD; git diff HEAD empty afterwards.
  • pnpm --filter @object-ui/app-shell run type-check — lock VERDICT command-exit 0.
  • dispatch-gates.mjs --commands derived families, all run locally, all exit 0; --ran reconciliation: 38 of 38 accounted for:
  • exit 0 · node scripts/check-closing-keyword-parity.mjs
  • exit 0 · node scripts/check-closing-keyword-parity.mjs --self-test
  • exit 0 · node scripts/check-comment-mask-corpus.mjs
  • exit 0 · node scripts/check-sdui-manifest.mjs
  • exit 0 · node scripts/check-sdui-manifest.mjs --self-test
  • exit 0 · pnpm --dir ui exec vitest run scripts/
  • exit 0 · pnpm --filter @objectstack/spec run check:duration-unit-keys
  • exit 0 · pnpm check:adr-anchors
  • exit 0 · pnpm check:cross-package-test-inputs
  • exit 0 · pnpm check:dispatcher-error-vocabulary
  • exit 0 · pnpm check:driver-memory-census
  • exit 0 · pnpm check:engine-double-contract
  • exit 0 · pnpm check:gitlink-declared
  • exit 0 · pnpm check:nul-bytes
  • exit 0 · pnpm check:published-files
  • exit 0 · pnpm check:query-options-erasure
  • exit 0 · pnpm check:refd-timer-probe
  • exit 0 · pnpm check:registry-log-declared
  • exit 0 · pnpm check:rest-log-spy-declared
  • exit 0 · pnpm check:skill-identifier-liveness
  • exit 0 · pnpm check:test-source-alias
  • exit 0 · pnpm check:tier-file-adoption
  • exit 0 · pnpm check:type-check-coverage
  • exit 0 · pnpm check:type-check-debt
  • exit 0 · pnpm check:undeclared-dep-imports
  • exit 0 · pnpm check:watch-hint-literal
  • exit 0 · pnpm check:where-matcher
  • exit 0 · node scripts/check-adr-0087-registration.mjs --base origin/main
  • exit 0 · node scripts/check-adr-0087-registration.mjs --self-test
  • exit 0 · node scripts/check-changeset-no-major.mjs --base origin/main
  • exit 0 · node scripts/check-empty-changeset.mjs --base origin/main
  • exit 0 · node scripts/check-empty-changeset.mjs --self-test
  • exit 0 · node scripts/ci/snapshot-next.mjs --self-test
  • exit 0 · node scripts/pm/check-governed-queue-guard.mjs --self-test
  • exit 0 · node scripts/pm/release-rehearsal-clone.mjs --self-test
  • exit 0 · node scripts/release-pending-publish.mjs --self-test
  • exit 0 · pnpm check:changeset-gate-self-tests
  • exit 0 · pnpm check:closed-ceremony-text
  • CI at 10d4f44: 39 success · 13 expected skip · 0 failed (pr-state.mjs: mergeable_state clean).

Generated by Claude Code

…lone

Manage views, the view settings panel, Create View (list page and the data
page's Save as view) and a saved shared view's rename and save in place all
lead to a view metadata write the server refuses without manage_metadata.
They now read mayManageViews(isAdmin, useCanAuthorMetadata()), the answer the
Shared choice already reads.

Claude-Session: https://claude.ai/code/session_01JQwxbYXZHUaaZK86HquGRP
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 23, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj

维护者速读

组织管理员如果没有「管理元数据」权限,列表上就不再出现「管理视图」「视图设置」「新建视图」「另存为视图」「重命名」「保存到此视图」这些入口。以前点了会报 403,现在直接不显示。
要你做的:无(普通改动,席位自动合并)。

席位核对 — ACCEPT (L1) · repo:objectstack#1 · head 10d4f442 · 2026-11-23T22:41Z

  • Shape: Fixes #36448. ui/packages/app-shell/src/views/ only: ObjectView.tsx, objectViewTitleSwitcher.tsx, objectViewPluginSchema.ts, ObjectDataPage.tsx, objectViewViewSharing.ts, their tests, and a patch changeset for @object-ui/app-shell. Clause-②: no. Metadata-protocol: none. The renamed predicate (mayShareViews to mayManageViews) and the renamed canManageViews props are module-internal; none is exported from the package index.
  • Read: one answer, mayManageViews(isAdmin, useCanAuthorMetadata()), now gates every entry that leads to a view metadata write: Manage views, the view settings panel, Create View, the title switcher's Add view and Manage views, the plugin's allowCreateView and view actions, Save as view, and (declared as an in-place extension, seat-approved) Rename and Save to this view on a saved shared view. isAdmin alone still gates what only reads.
  • Tests: 26/26 on 4 files; the thread's reverse run turns 4 of the new cases red with the gate removed.
  • Gates: 41 success, 15 expected skip, 0 failed on 10d4f442; mergeable_state clean.
  • Landing: the seat readies the PR and arms auto-merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

console: Manage views, view settings and Create View are offered on isAdmin alone, so an org admin without manage_metadata meets a 403

2 participants