Although the patronimages syspref says it sets whether or not patron images can be uploaded, in fact all it does is toggle display. The uploader should probably not be available when the feature is disabled, to prevent librarians from getting frustrated when it seems not to work.
Created attachment 84946 [details] [review] Bug 9422: Don't allow access to 'Upload patron images' when patronimages syspref is off In addition to checking the patron image upload permission, this adds a check for the patronimages system preference to the tools home page and sidebar. To test: - Check that the patron image upload tool only displays when - system preference patronimages is set to 'Allow' and user is either - superlibrarian or - has bath_upload_patron_images permission - Save URL of patron image uploader page - Turn off patronimages - Verify you get redirected to the home page of Koha when trying to access the page Note: this redirect is already used by the stock rotation feature.
Created attachment 85021 [details] [review] Bug 9422: Don't allow access to 'Upload patron images' when patronimages syspref is off In addition to checking the patron image upload permission, this adds a check for the patronimages system preference to the tools home page and sidebar. To test: - Check that the patron image upload tool only displays when - system preference patronimages is set to 'Allow' and user is either - superlibrarian or - has bath_upload_patron_images permission - Save URL of patron image uploader page - Turn off patronimages - Verify you get redirected to the home page of Koha when trying to access the page Note: this redirect is already used by the stock rotation feature. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Seems sound, works for me. Signing off
Wouldn't be better to display warning on top of patron image upload page?
I was looking for an example for that. I will have another look. Maybe just push a variable to the template and wrap it all in if-else?
... or just use the TT plugin. I will try it out.
Created attachment 102039 [details] [review] Bug 9422: Don't allow access to 'Upload patron images' when patronimages syspref is off In addition to checking the patron image upload permission, this adds a check for the patronimages system preference to the tools home page and sidebar. To test: - Check that the patron image upload tool only displays when - system preference patronimages is set to 'Allow' and user is either - superlibrarian or - has bath_upload_patron_images permission - Save URL of patron image uploader page - Turn off patronimages - Verify you get redirected to the home page of Koha when trying to access the page Note: this redirect is already used by the stock rotation feature. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
I'd like to throw the rebased patch out there - I didn't find an example for a page with a message in staff. Stock rotation for example behaves the same as this patch.
This one has languished long enough, I think it's a reasonable patch and trivial code.. upgrading my earlier signoff to a PQA
Nice work everyone! Pushed to master for 20.05
Backported to 19.11.x branch for 19.11.06
backported to 19.05.x for 19.05.11