https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42720

--- Comment #2 from Kyle M Hall (khall) <[email protected]> ---
Created attachment 202841
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202841&action=edit
Bug 42720: Add public REST API endpoints for running and fetching public
reports

This patch adds the OPAC equivalents of the staff reports endpoints,
under /public, matching what opac/svc/report does today. They reuse the
same controller as the staff endpoints, keying off the is_public stash
flag the API authentication guard sets for /public routes, so the two
sides expose an identical interface and differ only in the path.

POST /public/reports/{report_id}/run runs a report that is flagged
public. GET /public/reports/job/{job_id}/results fetches a background
run's results, but only for jobs whose report is public.

A single endpoint can't serve both the staff and public cases because
the guard decides public vs staff from the /public path prefix before
the controller knows which report was requested, so a sibling /public
route is the right shape.

Test Plan:
1) Apply this patch
2) Restart all the things!
3) Enable the RESTPublicAPI and RESTPublicAnonymousRequests system preferences
4) Create a SQL report and mark it public, e.g. SELECT 1 AS one, 2 AS two
5) curl -X POST http://localhost:8080/api/v1/public/reports/<id>/run \
     -H 'Content-Type: application/json' -d '{"run_type":"foreground"}'
6) Note the rows are returned without any authentication!
7) Mark the report as not public
8) Repeat step 5
9) Note you now get a 404!

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to