WhisperJobRepository
in package
Binds NLP-issued Whisper job IDs to the LWT user that started them.
Without this binding, /api/v1/whisper/status/{id}, /result/{id}, and DELETE /job/{id} would accept arbitrary job IDs, letting any authenticated user read or cancel another user's transcription if the UUID leaked or was guessed.
Tags
Table of Contents
Methods
- forget() : void
- Delete the binding (called after cancelJob succeeds so the row does not pile up forever).
- isOwnedByCurrentUser() : bool
- Verify the current user owns the job. Returns false for unknown job IDs too, so callers can render a generic 404 without leaking existence to the attacker.
- recordForCurrentUser() : void
- Record that the current user owns the given job ID.
- jobExists() : bool
Methods
forget()
Delete the binding (called after cancelJob succeeds so the row does not pile up forever).
public
forget(string $jobId) : void
Parameters
- $jobId : string
isOwnedByCurrentUser()
Verify the current user owns the job. Returns false for unknown job IDs too, so callers can render a generic 404 without leaking existence to the attacker.
public
isOwnedByCurrentUser(string $jobId) : bool
Parameters
- $jobId : string
Return values
boolrecordForCurrentUser()
Record that the current user owns the given job ID.
public
recordForCurrentUser(string $jobId) : void
In single-user mode the WjUsID column is NULL — there is exactly one user, so binding is meaningless, but we still write the row so isOwnedByCurrentUser can short-circuit on existence.
Parameters
- $jobId : string
-
Job ID returned by the NLP service
jobExists()
private
jobExists(string $jobId) : bool
Parameters
- $jobId : string