Description
Andrew Fuerste-Henry
2025-02-14 15:11:47 UTC
Created attachment 178123 [details] [review] Bug 39142 Add debug permission to allow user to toggle JS and CSS customizations on/off Database changes for 39142 Created attachment 178294 [details] [review] Bug 39142: Add debug permission to allow user to toggle JS and CSS customizations on/off to test: 1. apply the patch 2. use updatedatabase run to update your db 3. add custom JS and CSS in the IntranetUserJS and IntranetUserCSS fields 4. with as SuperLibrarian account confirm you have 3 buttons at the bottom of your screen, Disable User JS, Disable User CSS, and load only default stylesheets 5. clicking the buttons should reload the current page with a query to disable those things. 6. Log in as a user that is not a superlibrarian and does not have the debug UI permission enabled 7. confirm the buttons are no longer visible 8. Add the debug UI permission to the user 9. confirm the debug buttons are now visible for that user. Created attachment 178481 [details] [review] Bug 39142 Add debug permission to allow user to toggle JS and CSS customizations on/off Database changes for 39142 Signed-off-by: Lari Strand <lari.strand@koha-suomi.fi> Created attachment 178482 [details] [review] Bug 39142: Add debug permission to allow user to toggle JS and CSS customizations on/off to test: 1. apply the patch 2. use updatedatabase run to update your db 3. add custom JS and CSS in the IntranetUserJS and IntranetUserCSS fields 4. with as SuperLibrarian account confirm you have 3 buttons at the bottom of your screen, Disable User JS, Disable User CSS, and load only default stylesheets 5. clicking the buttons should reload the current page with a query to disable those things. 6. Log in as a user that is not a superlibrarian and does not have the debug UI permission enabled 7. confirm the buttons are no longer visible 8. Add the debug UI permission to the user 9. confirm the debug buttons are now visible for that user. Signed-off-by: Lari Strand <lari.strand@koha-suomi.fi> Just a thought, we use multiple Koha plugins that inject Javascript or CSS to the intranet views (subs intranet_js/css in plugin main modules). The plugins can always be disabled but maybe it should be considered as an option in this new feature? A possible future enhancement to enable that maybe setting up a plugin hook for plugins to either add to the query string generated by the debug buttons here or add debug buttons of their own. Created attachment 183392 [details] [review] Bug 39142 Add debug permission to allow user to toggle JS and CSS customizations on/off Database changes for 39142 Signed-off-by: Lari Strand <lari.strand@koha-suomi.fi> Created attachment 183393 [details] [review] Bug 39142: Add debug permission to allow user to toggle JS and CSS customizations on/off to test: 1. apply the patch 2. use updatedatabase run to update your db 3. add custom JS and CSS in the IntranetUserJS and IntranetUserCSS fields 4. with as SuperLibrarian account confirm you have 3 buttons at the bottom of your screen, Disable User JS, Disable User CSS, and load only default stylesheets 5. clicking the buttons should reload the current page with a query to disable those things. 6. Log in as a user that is not a superlibrarian and does not have the debug UI permission enabled 7. confirm the buttons are no longer visible 8. Add the debug UI permission to the user 9. confirm the debug buttons are now visible for that user. Signed-off-by: Lari Strand <lari.strand@koha-suomi.fi> Rebased on main. Waiting on feedback to PQA but looks good and working. I was reflecting on this idea... and it doesn't really seem like a user "permission" but rather a user "preference". This could be an opportunity to add a "borrower_ui_preferences" table for storing this sort of user preference. -- Alternatively, there are other user preferences like language which are managed by cookies like KohaOpacLanguage (see the patches on Bug 39206 for other Koha managed cookies). While I don't like the idea of adding more cookies to Koha... that could be an alternative path forward. -- As an aside, I'm trying to re-think Koha permission models, and something like this really sticks out. I suppose an argument could be made for it as a "view_debug_button" permission, but I think that's a stretch. If there were a permission, it would be on the ability to disable those sysprefs and then the "view_debug_button" operation would be hinged off that permission, so that only people authorized to perform that operation could view that button. I think it would make sense to introduce patron preferences as David said. Not sure whether this needs to necessarily be tied to just ui preferences, though. On Mattermost, Lisette raised an interesting point. A permission would make sense, if the permission actually controlled the functionality added by bug 14004. |