Rindle.TusResumeAuthorizer behaviour (Rindle v0.1.9)

Copy Markdown View Source

Behaviour contract for optional tus resume authorization hooks.

This hook runs after a tus URL signature has been verified and the upload session row has been loaded, but before any body or storage I/O is performed for HEAD, PATCH, or DELETE.

Summary

Callbacks

Authorizes a resume-capable tus request.

Types

resume_method()

@type resume_method() :: :head | :patch | :delete

subject()

@type subject() :: %{
  token_actor: term(),
  session: Rindle.Domain.MediaUploadSession.t(),
  profile: module(),
  method: resume_method()
}

Callbacks

authorize(actor, action, subject)

@callback authorize(actor :: term(), action :: :resume, subject()) :: :ok | :reject

Authorizes a resume-capable tus request.

Return :ok to allow the request or :reject to deny it with 401.