Bug 28236

Summary: Selecting database columns for system preferences in standard and dev installs is broken
Product: Koha Reporter: Martin Renvoize (ashimema) <martin.renvoize>
Component: Staff interfaceAssignee: Johanna Räisä <johanna.raisa>
Status: CLOSED FIXED QA Contact: Tomás Cohen Arazi (tcohen) <tomascohen>
Severity: critical    
Priority: P5 - low CC: david, dcook, fridolin.somers, gmcharlt, johanna.raisa, jon.turner, jonathan.druart, kyle, magnus, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes Apache access to json files in koha-tmpl for non-package installs. This causes issues for system preferences where there is a pick list for database columns. Bug 22844 introduced a pick list of database columns for system preferences where such a list was required. This list is in a plain json file under the templates directory. This works fine for packages, but because of bug 9812 (which limited browser access to selected files) those directories are not accessible to the outside world for both standard and dev type installs using the make process.
Version(s) released in:
21.11.00
Circulation function:
Bug Depends on: 9812, 22844    
Bug Blocks:    
Attachments: Bug 28236: Selecting database columns for system preferences in standard and dev installs is broken
Bug 28236: Selecting database columns for system preferences in standard and dev installs is broken
Bug 28236: Allow access to json files from apache config

Description Martin Renvoize (ashimema) 2021-04-27 11:58:04 UTC
With bug 22844 we introduced a pick list of database columns for system preferences where such a list was required.

However, the list is in a plain json file under the templates directory.  This works fine for packages, but because of bug 9812 those directories are not accessible to the outside world for both standard and dev type installs using the make process.

We need to resolve this somehow.. and it raises the question as to whether templates should be available to view on packages at all?
Comment 1 Tomás Cohen Arazi (tcohen) 2021-04-27 12:17:54 UTC
Should we just produce an API route for that...
Comment 2 Martin Renvoize (ashimema) 2021-04-27 12:46:52 UTC
Or use the API specs that are already available perhaps?
Comment 3 Johanna Räisä 2021-09-02 08:22:54 UTC
We have finally started our upgrading process to the newest Koha release and this problem came out when our superlibrarian was trying to set again systempreferences. 

This is a kind of show stopper. Maybe we could open those json-files from Apache?
Comment 4 Johanna Räisä 2021-09-02 10:00:23 UTC
Created attachment 124424 [details] [review]
Bug 28236: Selecting database columns for system preferences  in standard and dev installs is broken

This patch grants json files from koha-tmpl. Otherwise systempreferences won't be able to fetch them.

TEST PLAN:

1) Try to set systempreference BorrowerUnwantedField.
2) The modal is empty.
3) Modify Apache configurations like in this patch.
4) Try again set the systempreference.
5) The modal should show list of parameters.

Sponsored-by: Koha-Suomi Oy
Comment 5 Martin Renvoize (ashimema) 2021-10-21 08:38:32 UTC
Oops, I totally missed that you had added a patch here... looks good, signing off.
Comment 6 Martin Renvoize (ashimema) 2021-10-21 08:39:32 UTC
Created attachment 126645 [details] [review]
Bug 28236: Selecting database columns for system preferences in standard and dev installs is broken

This patch grants json files from koha-tmpl. Otherwise systempreferences won't be able to fetch them.

TEST PLAN:

1) Try to set systempreference BorrowerUnwantedField.
2) The modal is empty.
3) Modify Apache configurations like in this patch.
4) Try again set the systempreference.
5) The modal should show list of parameters.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Fridolin Somers 2021-11-03 07:27:08 UTC
From Martin request, I test this since we use dev install in production servers.
We usually use Nginx but we have some Apache installs (because of Sibboleth).

Works fine, I reproduce the HTTP 403 without this patch.

Passed QA
Comment 8 Jonathan Druart 2021-11-03 12:26:42 UTC
Created attachment 127248 [details] [review]
Bug 28236: Allow access to json files from apache config

This patch grants json files from koha-tmpl. Otherwise systempreferences won't be able to fetch them.

TEST PLAN:

1) Try to set systempreference BorrowerUnwantedField.
2) The modal is empty.
3) Modify Apache configurations like in this patch.
4) Try again set the systempreference.
5) The modal should show list of parameters.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

JD Amended patch: replace tab characters and reword commit title
Comment 9 Jonathan Druart 2021-11-03 14:30:40 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 10 Jonathan Druart 2021-11-03 14:35:32 UTC
Congratulations for your first patch pushed, Johanna!
Comment 11 Johanna Räisä 2021-11-09 08:17:45 UTC
(In reply to Jonathan Druart from comment #10)
> Congratulations for your first patch pushed, Johanna!

Nice, thank you very much. :)