Skip to main content

set

Function set 

Source
pub async fn set(
    pool: &PgPool,
    actor: &Actor,
    project_id: Uuid,
    update: ConditionsUpdate,
    origin: &Origin,
) -> AppResult<Conditions>
Expand description

Sets the conditions on membership of a restricted group (managers and administrators).

§Invariants

  • Permission: the actor manages the group (403; “not found” for a group the actor may not know); the group must be restricted (409). Tightening is open to managers and administrators; loosening (a condition removed, a value or range added, a longer or no sign-in age) is for the managers while administrators are limited by the policy, like project_policy::set_access.
  • Locks: the group row (FOR UPDATE).
  • Data: validated by validate (400). A member of the group may not set conditions that their own request would fail (409: they would lock themselves out). No change, no audit entry.
  • Audit: project.conditions with the old and the new conditions.
  • Notifications / webhooks: the other managers get an access alert; no webhooks.
  • Atomic: one transaction.