fix(platform-objects): allow import/export on sys_business_unit_member (#3025 / #3391 P0)#3394
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
#3025 / #3391 P0) Completes the #3025 point-fix. #3392 added import/export to sys_business_unit but left the sibling membership table on a CRUD-only whitelist, so the HRIS org-tree sync scenario (units + memberships imported together) still 405'd on the membership import/export path. #3391's P0 checklist pairs both tables; this is the half #3392 missed. - sys_business_unit_member enable.apiMethods gains 'import','export'. - Reconcile-safe: import/export are not in MANAGED_WRITE_VERB_AFFORDANCE, so reconcileManagedApiMethods (managedBy:'platform') never strips them — the declared whitelist reaches apiAccessDenialFromEnable intact. - Regression test locks import/export + CRUD, proven red-before-green. Transitional per #3391 P2 (derived import/export mapping reclaims both objects). Refs #3025, #3391. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
xuyushun441-sys
force-pushed
the
claude/charming-rosalind-231d99
branch
from
July 21, 2026 15:55
f56cc59 to
0f9d607
Compare
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 2 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
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.
背景
延续 #3025 / PR #3392。#3392 给
sys_business_unit补上了enable.apiMethods白名单里的'import'/'export',解掉了业务单元列表页 Import/Export 按钮的 405(OBJECT_API_METHOD_NOT_ALLOWED)。但 HRIS 组织树同步的完整场景是「单元表 + 成员表」两张一起批量导入——sys_business_unit_member仍停在 CRUD-only 白名单上,成员导入/导出路径照样 405。#3391 的 P0 清单本就把两张表配对,本 PR 补上 #3392 漏掉的那一半。改动
packages/platform-objects/src/identity/sys-business-unit-member.object.ts:104—apiMethods追加'import','export'。导入复用对象已授予的create/updateaffordance,导出是批量读。platform-objects.test.ts):锁死import/export存在 + 保留 CRUD 五件套。已防假绿:回退对象改动后测试如实变红(expected [...] to include 'import')。managedBy:'platform',但reconcileManagedApiMethods只剥通用写动词(create/update/upsert/delete/purge—MANAGED_WRITE_VERB_AFFORDANCE);import/export不在其中,永不被剥离,声明的白名单原样到达 REST gate(apiAccessDenialFromEnable),故静态测试断言即运行时行为,无假绿。过渡态
按 #3391 P2,per-object 的
import/export显式声明将被一张派生映射表替代(import ⊆ create/update、export ⊆ list),届时两张业务单元对象的显式条目一起回收。测试与对象注释均已写明此过渡语义,防止后续被当样板回退。验证
pnpm -C packages/platform-objects exec vitest run→ 214/214 全过。tsc --noEmit→ 0 错。附:全仓「显式 apiMethods 白名单」对象盘点(#3026 §4 缺口盘点)
扫描
packages/**(cloud/在本仓无apiMethods声明;objectui为独立仓,其 ImportWizard 405 兜底已由 #3391 P0 objectui 项跟踪)。判据:import ≈ 批量 create/upsert,export ≈ 批量 read;区分无意缺口(补)vs 刻意限制(留,通常带注释/测试锁死)。✅ 本 PR 放开(无意缺口,#3391 P0 已授权)
sys_business_unitsys_business_unit_member⏸ 全 CRUD 但不宜现在显式加——等 #3391 P1/P2 派生契约统一处理
sys_user_position、sys_user_permission_set、sys_position_permission_set、sys_position、sys_capability、sys_permission_set(RBAC 配置/授权)、sys_approval_delegation、sys_user_preference、sys_view_definition(元数据走 metadata protocol)。🔒 刻意限制 / 天然不该导入——保持封死
apiMethods: []:sys_jwks、sys_oauth_resource、sys_oauth_client_resource、sys_oauth_access_token、sys_oauth_consent、sys_oauth_client_assertion、sys_oauth_refresh_token(OAuth/密钥/令牌内部件)。sys_api_key、sys_two_factor、sys_secret、sys_device_code、sys_verification、sys_account、sys_session、sys_scim_provider、sys_sso_provider。sys_user(get,list,update——创建/删除走邀请+auth,另有专用批量用户导入流 批量导入用户:默认走 invite,temporary(临时密码)降级为不可投递行的兜底 #3236,不走通用 data import)、sys_member、sys_organization、sys_invitation。sys_job、sys_job_run、sys_job_queue、sys_automation_run、sys_import_job(有 ADR-0103 引擎自持锁死注释,导入「导入作业」本身无意义)。sys_email、sys_notification、sys_setting、sys_setting_audit、sys_audit_log、sys_activity、sys_metadata*。notification_receipt、notification_delivery、http_delivery。sys_presence、sys_record_share、sys_share_link、sys_approval_request/approver/token/action、sys_audience_binding_suggestion、sys_team、sys_team_member。sys_oauth_application:刻意锁死(注释 +platform-objects.test.ts断言not.toContain('create'/'update'/'delete'),所有写经 better-auth 包装器)。Refs #3025, #3391.
🤖 Generated with Claude Code