pub async fn cancel_checkout(
pool: &PgPool,
actor: &Actor,
id: Uuid,
reason: Option<&str>,
) -> AppResult<Revision>Expand description
Releases the edit lock without uploading anything (“cancel check-out”).
Administrators may release locks of other users, managers of the item’s
group those of users who are gone: no longer members (who cannot release
them themselves once a restricted group hides the revision) or
deactivated. A check-in with new file versions is files::check_in;
the bulk release for one holder is checkouts::release_held.
§Invariants
- Permission: CAD editor; the revision is visible (“not found” otherwise). Nothing happens
when it is not checked out. Another user’s check-out may be released by an administrator,
by a manager of the group when that user is no longer a member or is deactivated, or by a
manager of the group for an active member with a
reason(issue #173, step 6); 403 otherwise (a manager without a reason is told to give one). - Data: a reason has
RELEASE_REASON_MINtoRELEASE_REASON_MAXcharacters (400). - Locks: the revision row (
revisions::lock). - Audit:
revision.checkout_cancel;revision.checkout_forced_releasewhen the check-out was held by someone else, with the reason. - Notifications: on a forced release the former holder, with the reason; otherwise none.
- Webhooks: none.
- Atomic: one transaction.