https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921
--- Comment #166 from Brendan Lawlor <[email protected]> --- Created attachment 208041 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208041&action=edit Bug 41921: (QA follow-up) Filter report jobs by library before paging When LimitReportsByLibrary is enabled, GET /api/v1/reports/jobs hid jobs for reports the user cannot access by checking can_access on each job after the page had been fetched. The pagination headers were already set from the unfiltered query, so X-Total-Count included the hidden jobs, and pages could come back short or empty. This patch filters the jobs in the query, before paging, using Koha::Reports->search_with_library_limits. Jobs are listed if their report has no library limits, is limited to the user's library, or has been deleted. Users who can manage report limits still see every job. X-Total-Count, paging and sorting now all count the same jobs. Test plan: 1. Enable LimitReportsByLibrary 2. Create two saved SQL reports, A and B. Limit report B to a library other than your test staff user's library 3. As a superlibrarian, run both reports and choose "Queue as background job". The jobs do not need to finish 4. Log in as a staff user with catalogue, execute_reports_foreground and execute_reports_background permissions, but not manage_report_limits 5. Go to Reports > Report jobs 6. Note only report A's job is shown, but the table says "Showing 1 to 1 of 2 entries" 7. Apply patch and restart_all 8. Reload Reports > Report jobs 9. Note the table now says "Showing 1 to 1 of 1 entries" 10. Log in as the superlibrarian and note both jobs are shown 11. Run: prove t/db_dependent/api/v1/reports_jobs.t Sponsored-by: CLAMS Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Brendan Lawlor <[email protected]> -- 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/
