Koha-clms/reports
Jonathan Druart 139e119a16
Bug 38414: [22.11] backport to 22.11
Bug 38414: Fix permission controller-side

This bug refactors the preview sql buttons to pass the permissions granted for each report to
the javascript that clones and updates the modal.

That allows us to check for the appropriate permissions when preparing the buttons for the modal
and to remove any that are not allowed.

This allows for different permissions per report for future devs
(see bugs 42406, 16631)

To test:
1. Create some reports
2. Create a user with only execute_reports permissions
3. Login as that user and go to Reports > use saved
4. In the actions column click the ^ and select 'Preview sql'
5. Notice delete button renders and works to delete
6. Apply patch and restart_all
7. Repeat step 4, now only the Run report button renders and works
8. Add permissions for create_reports
9. Repeat step for, now Edit, Duplicate, Schedule and run buttons render and work
10. Add permissions for delete_reports
11. Repeat step 4, confirm the delete button renders and works
12. Confirm the preview sql button works to preview different reports

We also fix some error in the script, several wrong things there:
* delete was not replaced with cud-delete
* missing op for the creation of new reports
* update and run requires two permssions

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Scott Barter <sbarter@aacpl.net>

Bug 38414: (follow-up) comprehensively cover ops with required permissions

Test plan:
0. Apply the patch and restart_all

1. Using a user with only "create_reports", "execute_reports", or "delete_reports",
try to perform operations not covered by that permission.
That is, if you have "create_reports", try to run, export, and delete reports.
If you have "execute_reports", try to create, modify, and delete reports
If you have "delete_reports", try to create, modify, and run reports

2. Note that a user with each of these permissions can list and view SQL.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 38414: (QA follow-up) Adjust templates

Now that we can explicitly list reports with any one of the permissions we need
to adjust some displays to ensure we can get to the list view.

Additionally I change 'Use saved' to 'View saved' since we may not be able to run.

I also fix the action buttons to show 'View' instead of 'Run' if user cannot execute.

I adjust reports home to check if the user can use report plugins before showing that link as well

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 38414: (follow-up) Fix OR operator

Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
2026-05-28 12:12:57 +12:00
..
acquisitions_stats.pl Bug 28327: Unify CSV delimiter special behavior for tabulation 2022-08-19 15:53:12 -03:00
bor_issues_top.pl Bug 28327: Unify CSV delimiter special behavior for tabulation 2022-08-19 15:53:12 -03:00
borrowers_out.pl Bug 28967: Patrons with no checkouts report shows patrons from other libraries with IndependentBranches 2022-10-17 08:10:59 -03:00
borrowers_stats.pl Bug 28327: Unify CSV delimiter special behavior for tabulation 2022-08-19 15:53:12 -03:00
cash_register_stats.pl Bug 33339: Prevent Formula Injection (CSV Injection) in CSV files 2024-11-07 23:29:11 +00:00
cat_issues_top.pl Bug 28327: Unify CSV delimiter special behavior for tabulation 2022-08-19 15:53:12 -03:00
catalog_by_itemtype.pl Bug 31988: Remove reports/itemtypes.plugin 2024-03-25 08:16:32 +00:00
catalogue_out.pl Bug 42361: Fix SQL injection in catalogue_out.pl 2026-05-27 13:06:40 +12:00
catalogue_stats.pl Bug 28327: Unify CSV delimiter special behavior for tabulation 2022-08-19 15:53:12 -03:00
dictionary.pl Bug 37784: [24.05] (QA follow-up) Bail out to new definition 2025-03-24 15:33:19 +00:00
guided_reports.pl Bug 38414: [22.11] backport to 22.11 2026-05-28 12:12:57 +12:00
issues_avg_stats.pl Bug 28327: Unify CSV delimiter special behavior for tabulation 2022-08-19 15:53:12 -03:00
issues_stats.pl Bug 28327: Unify CSV delimiter special behavior for tabulation 2022-08-19 15:53:12 -03:00
itemslost.pl Bug 33339: Prevent Formula Injection (CSV Injection) in CSV files 2024-11-07 23:29:11 +00:00
orders_by_fund.pl Bug 28327: Unify CSV delimiter special behavior for tabulation 2022-08-19 15:53:12 -03:00
reports-home.pl Bug 34859: Remove unnecessary params from reports-home.pl 2023-10-17 17:23:41 +00:00
reserves_stats.pl Bug 28327: Unify CSV delimiter special behavior for tabulation 2022-08-19 15:53:12 -03:00
serials_stats.pl Bug 28327: Unify CSV delimiter special behavior for tabulation 2022-08-19 15:53:12 -03:00