Skip to main content

secure_update_with_scope

Function secure_update_with_scope 

Source
pub async fn secure_update_with_scope<E>(
    am: E::ActiveModel,
    scope: &AccessScope,
    id: Uuid,
    runner: &impl DBRunner,
) -> Result<E::Model, ScopeError>
Expand description

Secure update helper for updating a single entity by ID inside a scope.

§Security

  • Verifies the target row exists within the scope before updating.
  • For tenant-scoped entities, forbids changing tenant_id (immutable).

§Errors

  • ScopeError::Denied if the row is not accessible in the scope.
  • ScopeError::Denied("tenant_id is immutable") if caller attempts to change tenant_id.