Skip to content

Rights check on ListCorpusWorkerVersions

Erwan Rouchet requested to merge check-list-corpus-versions into master

Requires !1771 (merged), closes #1116 (closed)

  • The API endpoint description is moved to the class docstring to follow the API best practices
  • Added a more explicit description of the required rights on corpora and workers
  • Converted the get_corpus() helper to a cached property to follow the API best practices and remove a possible duplicate query
  • Removed the revision__versions prefetch, which became unnecessary when we removed the Revision.state cached property in !1204 (merged)
  • Reduced the amount of SQL queries by using prefetch objects. Doing an INNER JOIN between WorkerVersion and Revision using a .select_related() was found to be slow, which is why we switched to lots of prefetches, but joins between revisions and repositories, or workers and worker types are lighter.
  • Added a test to ensure that you can still browse the worker versions on a public corpus, even when you are logged in and don't have a right on the corpus
  • Added a test to ensure that you cannot access a private corpus if you are not logged in
  • Updated all tests to have multiple versions in the response: only one version would not let us detect duplicate SQL queries
  • Removed a .order_by() that was ignored due to the CursorPagination's behavior
Edited by Erwan Rouchet

Merge request reports

Loading