Bug 41674 - Add template plugin for linking to system preferences based on user permission
Summary: Add template plugin for linking to system preferences based on user permission
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-01-21 14:18 UTC by Owen Leonard
Modified: 2026-01-21 15:26 UTC (History)
0 users

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41674: Add template plugin for linking to system preferences based on user permission (3.11 KB, patch)
2026-01-21 15:26 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 41674: (follow-up) Proof of concept: branches.pl (5.61 KB, patch)
2026-01-21 15:26 UTC, Owen Leonard
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2026-01-21 14:18:35 UTC
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&amp;ok=Search&amp;searchfield=RequireChoosingExistingAuthority">RequireChoosingExistingAuthority</a>

For a user without permission it outputs:

<span class="link_preference">RequireChoosingExistingAuthority</span>
Comment 1 Owen Leonard 2026-01-21 15:26:26 UTC
Created attachment 191791 [details] [review]
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&amp;ok=Search&amp;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
Comment 2 Owen Leonard 2026-01-21 15:26:29 UTC
Created attachment 191792 [details] [review]
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