Skip to main content

add_reviewer

Function add_reviewer 

Source
pub async fn add_reviewer(
    pool: &PgPool,
    actor: &Actor,
    change_id: Uuid,
    username: &str,
) -> AppResult<()>
Expand description

Assigns a reviewer. Authors cannot review their own change (four-eyes principle).

ยงInvariants

  • Permission: CAD editor who is the author (or an administrator); the change is a draft (409) and the actor sees every item of it (403); the reviewer is an active user with at least the editor role (400), is not the author (400) and sees every item (409).
  • Locks: the change row (FOR UPDATE).
  • Audit: change.add_reviewer, only when the reviewer was not yet assigned.
  • Notifications / webhooks: none.
  • Atomic: one transaction.