pub async fn secure_update_with_scope<E>(
am: E::ActiveModel,
scope: &AccessScope,
id: Uuid,
runner: &impl DBRunner,
) -> Result<E::Model, ScopeError>where
E: ScopableEntity + EntityTrait,
E::Column: ColumnTrait + Copy,
E::ActiveModel: ActiveModelTrait<Entity = E> + Send,
E::Model: IntoActiveModel<E::ActiveModel> + ModelTrait<Entity = E>,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::Deniedif the row is not accessible in the scope.ScopeError::Denied("tenant_id is immutable")if caller attempts to changetenant_id.