Skip to content

业务单元需要支持导入:列表页导入按钮 405(apiMethods 白名单缺 import/export) #3025

Description

@baozhoutao

现象

业务单元列表(Setup → Business Units)点「导入」按钮报错:

API operation 'import' is not allowed on object 'sys_business_unit'
(405, code: OBJECT_API_METHOD_NOT_ALLOWED)

「导出」按钮(export 操作)同样会被拒。

根因

REST 数据面按 ADR-0049 用对象上的 enable.apiMethods 白名单门控,而 sys_business_unit 的白名单只有 CRUD 五件套,没有 import/export:

// packages/platform-objects/src/identity/sys-business-unit.object.ts
apiMethods: ['get', 'list', 'create', 'update', 'delete'],

排查确认不是刻意限制(ADR-0057 与提交注释均未提及;真正刻意收紧的对象如 sys_oauth_application 都有注释 + 测试锁死),且该对象字段设计明确预期 HRIS 批量同步(external_refeffective_from/to 标注 "HRIS sync"),组织树本来就该支持批量导入。

修复

白名单补上 'import', 'export' 两个操作,并加回归测试断言。已本地验证:platform-objects 198 条测试全过。

复现

  1. 登录 console → Setup → Business Units
  2. 列表页点 Import,上传任意 CSV
  3. 观察 405 OBJECT_API_METHOD_NOT_ALLOWED

关联设计问题(UI 按钮与 apiMethods 白名单的前后端一致性)拆分至独立 issue。

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions