Skip to content

fix(core): supplier maintainers can edit but not delete suppliers - #19

Merged
marchtian merged 1 commit into
mainfrom
claude/project-thread-2wxink
Oct 23, 2026
Merged

marchtian merged 1 commit into
mainfrom
claude/project-thread-2wxink

Conversation

@marchtian

Copy link
Copy Markdown
Collaborator

Requested by 田騏 · project thread

为什么

#15 为了让品类经理能复核别人导入的供应商,给 srm_supplier_admin(品类经理、采购主管)和 srm_admin 开了 modifyAllRecords。平台的 modifyAllRecords 会连删除一起放开(objectstack#25470),结果品类经理和采购主管能删除任何供应商,联系人、证书随 master_detail 级联删除。设计上删除只给系统管理员。

修法由田騏在项目线程里选定:照 srm_material 的临时做法放宽 OWD。

改了什么

位置 改动
srm_supplier OWD 暂为 public_read_write(目标仍是 public_read,注释与 02 §4.1 写明临时、链接 objectstack#25470)
srm_supplier_admin、srm_admin 去掉 modifyAllRecords,回到 allowEdit + allowDelete: false
srm_quality 对供应商的编辑权只为写证书(controlled_by_parent 要求父记录可编辑),供应商全部字段经 FLS 只读(按对象字段生成,新增字段自动覆盖)
文档 02 §4.1、04 §2.3 同步

验证

  • 新增权限测试:品类经理、采购主管能改别人建的供应商但删不了;SQE 改不了供应商字段、删不了;采购员、应付会计改不了。第一条在 main 上失败(删除成功),本分支通过。
  • pnpm validate、lint、typecheck、i18n:check、test(10 个文件全部通过)、build。

Generated by Claude Code

#15 gave srm_supplier_admin and srm_admin modifyAllRecords on
srm_supplier so category managers could review suppliers imported by an
admin. The platform's modifyAllRecords also grants delete
(objectstack#25470), so category managers and buyer leads could delete
any supplier and cascade its contacts and certificates.

Follow the srm_material workaround instead: srm_supplier OWD is
public_read_write for now, modifyAllRecords is dropped, and srm_quality
keeps its edit grant only for certificate writes with every supplier
field read-only through FLS. Tests cover edit-not-delete for category
managers and buyer leads, and read-only for SQE, buyers and AP.

Claude-Session: https://claude.ai/code/session_01WD2qxFMbYUkbEnsSXW7PQj
Co-authored-by: Claude <noreply@anthropic.com>
@marchtian marchtian self-assigned this Oct 23, 2026
@marchtian
marchtian merged commit 17fc179 into main Oct 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants