Skip to main content

set_access

Function set_access 

Source
pub async fn set_access(
    pool: &PgPool,
    actor: &Actor,
    project_id: Uuid,
    update: AccessUpdate,
) -> AppResult<PolicyView>
Expand description

Changes the interface switches and the log settings 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).
  • Locks: the group row (FOR UPDATE).
  • Data: the retention is 1 to 36500 days, the review interval 1 to MAX_REVIEW_INTERVAL_DAYS (400). Tightening (switching an interface off, the log on, a shorter review interval) is open to managers and administrators; loosening (switching one on, the log off, changing the retention, a longer or no review interval) is for the managers while administrators are limited by the policy, like set_admin_read. No change, no audit entry.
  • Audit: project.interfaces with old and new values.
  • Notifications / webhooks: the other managers get an access alert; no webhooks.
  • Atomic: one transaction.