Skip to content

field-approval

Four-eyes approval for payment-relevant fields. A host field declares access.approve: [roles]. In the host’s edit form a user who may write but not approve such a field sees it read-only with a ‘Request change’ action; a drawer lists every such field of the form and files only the changed ones in one batch of request-change commands, so the form keeps a single Save. An open request shows the requested value under the field and, for its requester, a withdraw action (reject-change). Approvers edit the field directly. The executor still refuses a direct change by anyone without an approve role (403 field_approval_required), which the form shows as a field error. A different person holding an approve role applies a request with approve-change or declines it with reject-change. pending-changes lists the open requests the caller may decide or has filed and, for an entityType, the caller’s gatedFields (entityId null for a record not created yet); the approval list screen shows them with approve, reject and withdraw actions, its nav entry sits in the tenant admin area unless the app passes nav. The requested value is encrypted under the host record’s subject, so forgetting the host makes it unreadable. Mount with createFieldApprovalFeature({ parents: [<host entities>] }).

The write commands this feature provides (Provides).

flowchart TB
  n_field_approval["field-approval"]
  subgraph how_provides["Provides"]
    n_cmd_field_approval_write_approve_change(["approve-change"])
    n_cmd_field_approval_write_reject_change(["reject-change"])
    n_cmd_field_approval_write_request_change(["request-change"])
  end
  n_field_approval --> n_cmd_field_approval_write_approve_change
  n_field_approval --> n_cmd_field_approval_write_reject_change
  n_field_approval --> n_cmd_field_approval_write_request_change

Provides — write commands this feature registers (dispatch them through the command bus):

  • Requires: none
  • Activation: always on (not toggleable)