Previous | Index

Editing Workflows: Owner, User, Approval

SimplyPages editing APIs support direct edits and staged edits.

Core Building Blocks

  • Editable<T> for module edit contracts.
  • EditModalBuilder for consistent modal composition.
  • EditMode for owner vs user behavior.
  • AuthWrapper and AuthorizationChecker for access control.

Owner Edit Workflow

  1. Authenticate and authorize opening the edit modal.
  2. Recheck resource permission and CSRF at save, then validate input.
  3. Apply edits directly.
  4. Persist changes.
  5. Return OOB swaps.

User Edit Workflow (Staged)

  1. Authenticate and authorize opening the edit modal.
  2. Recheck resource permission and CSRF at save, then validate input.
  3. Store change request in approval queue.
  4. Return pending status UI.
  5. Owner approves or rejects.

Minimal Handler Shape

public interface ModuleEditHandler<T> {
    Component renderEditForm(String moduleId);
    Component handleUpdate(String moduleId, Map<String, String> editData, EditMode editMode);
    Component handleDelete(String moduleId, EditMode editMode);
}

Request Mechanics

  • Edit open: GET /modules/{id}/edit
  • Save: POST /modules/{id}/save?editMode=OWNER_EDIT|USER_EDIT
  • Delete: DELETE /modules/{id}/delete?editMode=...
  • Nested child edit: GET /modules/{moduleId}/children/{childId}/edit
  • Nested child save/delete: POST or DELETE to the matching child endpoint

Operational Rules

  1. Treat every edit endpoint as auth-protected.
  2. Validate server-side before applyEdits.
  3. Keep audit trail for staged edits.
  4. Enforce authorization in the controller/service handler, not only by hiding buttons in the UI.
  5. Escape at render time. Store validated plain text from forms unless the application owns a sanitization pipeline for trusted HTML.
  6. Supply raw identifiers to framework URL templates; they are encoded once when interpolated. Applications own routing, decoding and business-ID validation.
  7. Return explicit 403, 404, or 400 responses for blocked permissions, missing records, and invalid positions or IDs.

Never trust a request-provided editMode as authorization. Derive the permitted mode server-side. Approval queues, persistence, and audit trails are application-owned.