feat(plugin-security): A4 — managed_by 三态统一 + listView 露出 (#2920)#2934
Merged
Conversation
Unify the record-level provenance vocabulary across sys_capability, sys_permission_set and sys_position onto platform / package / admin. - sys_permission_set.managed_by and sys_position.managed_by: text -> select (options platform/package/admin, defaultValue admin, readonly), matching sys_capability. - Writers re-stamped: built-in positions seed managed_by:'platform' (was 'system'); env/Studio-authored permission sets project managed_by:'admin' (was 'user'). - sys_position list views (active/default_positions/custom/all_positions) now surface the managed_by column. - No destructive migration: no runtime path branches on the legacy values (every access decision keys on 'package'/'platform'), so the rename never changes an authorization outcome. Built-ins/declared sets self-heal on their bootstrap upsert; new idempotent kernel:ready reconciler normalizeManagedByVocab rewrites residual legacy rows (system->platform, config->package, user->admin). - i18n: managed_by field + option labels added for all three objects across en / zh-CN / ja-JP / es-ES. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019QRUvVfpvSycAHMMF2xTxs
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 12 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
…A4 vocab) A4 unified record-level managed_by onto platform/package/admin; env-authored permission sets now project as 'admin' (formerly 'user'). Update the two showcase-permission-projection assertions the vocab change made stale. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019QRUvVfpvSycAHMMF2xTxs
…ed-by-tristate # Conflicts: # packages/plugins/plugin-security/src/security-plugin.ts
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.
A4 — 权限来源三态统一 + 露出(framework 侧)
Tracking: #2920. 跨仓配对 PR:objectstack-ai/objectui#2501。
管理员现在能用同一套词表分清权限集/岗位/能力是「平台发的 / 应用发的 / 自己建的」。三个 RBAC 目录对象的
managed_by此前各说各话,本 PR 统一为 platform / package / admin(以sys_capability为准)。改动
sys_permission_set.managed_by/sys_position.managed_by:text→ 约束select,选项platform/package/admin,defaultValue: 'admin',readonly—— 与sys_capability完全一致。bootstrapBuiltinRoles):managed_by: 'system'→'platform'。upsertEnvPermissionSet创建路径):'user'→'admin'。'package')与平台能力('platform')本就是规范值,未动。sys_position四个 listView(active/default_positions/custom/all_positions)补上managed_by列,与 capability/permission-set 视图对齐;并加入highlightFields。managed_by字段 + 选项标签(platform/package/admin),三对象 × 四语言(en / zh-CN / ja-JP / es-ES)补齐;顺带补sys_capability的 scope 选项标签。历史数据兼容策略(无破坏性 migration)
关键取舍:没有一处运行时逻辑对分歧的旧值分支——所有访问决策只读
'package'/'platform'(两者跨三对象本就一致、未改),因此这次是纯展示词表重命名,永不改变任何鉴权结果。bootstrapupsert 时自愈到规范值。'user'、旧岗位的system/config/user)由新增的幂等kernel:ready协调器normalizeManagedByVocab重写(system→platform、config→package、user→admin)。字段为readonly,故以isSystem上下文写入。bootstrapBuiltinRoles/bootstrapDeclaredPermissions等皆如此),与之保持一致。验证
pnpm --filter @objectstack/plugin-security test—— 341 passed(16 files)。pnpm --filter @objectstack/plugin-security build—— ESM/CJS/DTS 均通过。normalize-managed-by.test.ts(重写正确性 + 幂等 + 空 ql 容错);rbac-objects.test.ts新增三对象词表一致性 + 岗位视图列断言;projection/anchor 测试的创建路径断言随写入端更新(user→admin、system→platform)。存疑点
managed_by由text→select。select只在写入时校验选项、读取不校验,故残留旧值行仅在协调器跑到前展示原始字符串,无硬失败。security-plugin的 package 伪造闸(仍只认'package'),亦未改对象级managedBy: 'config'(那是 schema 保护级别,与记录级managed_by字段无关)。🤖 Generated with Claude Code
https://claude.ai/code/session_019QRUvVfpvSycAHMMF2xTxs