[Bug 41674] New: Add template plugin for linking to system preferences based on user permission
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 Bug ID: 41674 Summary: Add template plugin for linking to system preferences based on user permission Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: oleonard@myacpl.org Reporter: oleonard@myacpl.org QA Contact: testopia@bugs.koha-community.org There are many places in templates where we link to a system preference and we are inconsistent about whether these links are dependent on the permission of the logged-in user. I propose to add a template plugin which handles the permission check. [% "RequireChoosingExistingAuthority" | html | $LinkPref %] For a user with 'CAN_user_parameters_manage_sysprefs' permission it outputs: <a class="link_preference" href="admin/preferences.pl?op=search&ok=Search&searchfield=RequireChoosingExistingAuthority">RequireChoosingExistingAuthority</a> For a user without permission it outputs: <span class="link_preference">RequireChoosingExistingAuthority</span> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #1 from Owen Leonard <oleonard@myacpl.org> --- Created attachment 191791 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191791&action=edit Bug 41674: Add template plugin for linking to system preferences based on user permission This patch adds a new template plugin, LinkPref, for displaying system preference names as links depending on the logged-in user's permission. Syntax: [% "SYSTEM_PREFERENCE_NAME" | html | $LinkPref %] For a user with 'CAN_user_parameters_manage_sysprefs' permission it outputs: <a class="link_preference" href="admin/preferences.pl?op=search&ok=Search&searchfield=SYSTEM_PREFERENCE_NAME">SYSTEM_PREFERENCE_NAME</a> For a user without permission it outputs: <span class="link_preference">SYSTEM_PREFERENCE_NAME</span> Sponsored-by: Athens County Public Libraries -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #2 from Owen Leonard <oleonard@myacpl.org> --- Created attachment 191792 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191792&action=edit Bug 41674: (follow-up) Proof of concept: branches.pl This patch implements the new template plugin on Administration -> Libraries. - When viewed as a user with permission to manage system preferences, the system preference names under "Reply-To", "Return-Path", and "MARC organization code" should be linked to system preferences, and the link should take you to the correct preference search. - When viewed as a user without permission the system preference names should not be linked. Sponsored-by: Athens County Public Libraries -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Sponsorship status|--- |Sponsored Status|Needs Signoff |Signed Off Comma delimited| |Athens County Public list of Sponsors| |Libraries -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191791|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191792|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 193369 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=193369&action=edit Bug 41674: Add template plugin for linking to system preferences based on user permission This patch adds a new template plugin, LinkPref, for displaying system preference names as links depending on the logged-in user's permission. Syntax: [% "SYSTEM_PREFERENCE_NAME" | html | $LinkPref %] For a user with 'CAN_user_parameters_manage_sysprefs' permission it outputs: <a class="link_preference" href="admin/preferences.pl?op=search&ok=Search&searchfield=SYSTEM_PREFERENCE_NAME">SYSTEM_PREFERENCE_NAME</a> For a user without permission it outputs: <span class="link_preference">SYSTEM_PREFERENCE_NAME</span> Sponsored-by: Athens County Public Libraries Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 193370 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=193370&action=edit Bug 41674: (follow-up) Proof of concept: branches.pl This patch implements the new template plugin on Administration -> Libraries. - When viewed as a user with permission to manage system preferences, the system preference names under "Reply-To", "Return-Path", and "MARC organization code" should be linked to system preferences, and the link should take you to the correct preference search. - When viewed as a user without permission the system preference names should not be linked. Sponsored-by: Athens County Public Libraries Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #5 from David Nind <david@davidnind.com> --- A great idea Owen! Testing notes (using KTD): 1. I edited Henry Acevedo's account so I could log in as the patron in an incognito winodw. 2. I gave Henry these permissions: - Staff access, allows viewing of catalogue in staff interface (catalogue) - Manage Koha system settings (Administration panel) (parameters) - Then removed Manage system preferences (manage_sysprefs) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |jonathan.druart@gmail.com |y.org | Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #193369|0 |1 is obsolete| | Attachment #193370|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #6 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200739 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200739&action=edit Bug 41674: Add template plugin for linking to system preferences based on user permission This patch adds a new template plugin, LinkPref, for displaying system preference names as links depending on the logged-in user's permission. Syntax: [% "SYSTEM_PREFERENCE_NAME" | html | $LinkPref %] For a user with 'CAN_user_parameters_manage_sysprefs' permission it outputs: <a class="link_preference" href="admin/preferences.pl?op=search&ok=Search&searchfield=SYSTEM_PREFERENCE_NAME">SYSTEM_PREFERENCE_NAME</a> For a user without permission it outputs: <span class="link_preference">SYSTEM_PREFERENCE_NAME</span> Sponsored-by: Athens County Public Libraries Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #7 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200740 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200740&action=edit Bug 41674: (follow-up) Proof of concept: branches.pl This patch implements the new template plugin on Administration -> Libraries. - When viewed as a user with permission to manage system preferences, the system preference names under "Reply-To", "Return-Path", and "MARC organization code" should be linked to system preferences, and the link should take you to the correct preference search. - When viewed as a user without permission the system preference names should not be linked. Sponsored-by: Athens County Public Libraries Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #8 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200741 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200741&action=edit Bug 41674: Add a test Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #9 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200742 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200742&action=edit Bug 41674: Use LinkPref for CurbsidePickup Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #10 from Jonathan Druart <jonathan.druart@gmail.com> --- Developers need to know about this when it's pushed! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #200741|0 |1 is obsolete| | Attachment #200742|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #11 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200743 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200743&action=edit Bug 41674: Add a test Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #12 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200744 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200744&action=edit Bug 41674: Use LinkPref for CurbsidePickup Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |41522 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41522 [Bug 41522] Make system preferences clickable for warnings in About Koha > System information -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |release-notes-needed CC| |aleisha@catalyst.net.nz --- Comment #13 from Aleisha Amohia <aleisha@catalyst.net.nz> --- (In reply to Jonathan Druart from comment #10)
Developers need to know about this when it's pushed!
Absolutely - should be added to Coding guidelines on the wiki. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pedro.amorim@openfifth.co.u | |k Status|Passed QA |Failed QA --- Comment #14 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Hi guys, 1) There is an unused import in LinkPref.pm: use Koha::Patrons; 2) Synopsis POD of LinkPref.pm appears to be a copy paste Koha::Template::Plugin::HtmlScrubber 3) Variable pref_CurbsidePickup_link is left hanging with no use in curbside_pickup.tt Who is volunteering to add this to the coding guidelines? Should we have a QA check added to attempt to prevent future occurrences of CAN_user*? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #15 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 204088 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=204088&action=edit Bug 41674: Fix review issues - remove unused import, fix POD synopsis, remove unused variable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #16 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Pedro Amorim (ammopt) from comment #14)
Hi guys,
1) There is an unused import in LinkPref.pm: use Koha::Patrons;
2) Synopsis POD of LinkPref.pm appears to be a copy paste Koha::Template::Plugin::HtmlScrubber
3) Variable pref_CurbsidePickup_link is left hanging with no use in curbside_pickup.tt
Done.
Who is volunteering to add this to the coding guidelines? Should we have a QA check added to attempt to prevent future occurrences of CAN_user*?
Owen? :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 --- Comment #17 from Owen Leonard <oleonard@myacpl.org> ---
Who is volunteering to add this to the coding guidelines?
I'm happy to do this.
Should we have a QA check added to attempt to prevent future occurrences of CAN_user*?
I'm not sure how you'd do this... There are other reasons we check CAN_user_parameters_manage_sysprefs, e.g. [% IF ( CAN_user_parameters_manage_sysprefs ) %] <li> <a class="circ-button" href="/cgi-bin/koha/admin/preferences.pl?tab=cataloguing">Preferences</a> </li> [% END %] -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41674 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This patch adds a new release notes| |template plugin, LinkPref, | |to be used by template | |authors. The plugin outputs | |system preference names as | |links depending on the | |logged-in user's | |permission. It also | |implements use of this new | |plugin in the | |Administration -> Libraries | |template. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org