How to add a product field to the access rules
When adding a product form field, update the shared policy and its tests so the client and server continue to agree.
Steps
- Classify the field: ordinary edit, catalog logistics, vendor post-stock lock, catalog-required, or name component.
- Update
apps/web/utils/products/product-access.tsin the corresponding field set (DETAILS_FIELDS,VENDOR_LOCKED_FIELDS, orCATALOG_REQUIRED_FIELDS/NAME_FIELDS). Keep form field enumeration aligned where applicable. - If it is a PATCH logistics key, also update
apps/web/utils/products/logistics.tsso key presence invokes the server'srequireLogisticsEditguard and inaccessible DTOs omit it. - Update DTO mapping/validation and server persistence only as required by the field's contract. Do not assume UI read-only state is authorization.
- Add or update unit tests for partner/vendor, catalog on/off, create/edit, and omitted versus explicit null/false cases.
- Update the relevant field access reference and permission reference.