Bug 39453 - Add attribute type settings for restricting access to extended attributes
Summary: Add attribute type settings for restricting access to extended attributes
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: David Gustafsson
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-25 20:23 UTC by David Gustafsson
Modified: 2025-03-26 21:50 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 39453: Add attribute type settings for restricting access to extended attributes (36.75 KB, patch)
2025-03-25 20:45 UTC, David Gustafsson
Details | Diff | Splinter Review
Bug 39453: Schema changes (2.03 KB, patch)
2025-03-25 20:45 UTC, David Gustafsson
Details | Diff | Splinter Review
Bug 39453: Add attribute type settings for restricting access to extended attributes (38.10 KB, patch)
2025-03-26 21:50 UTC, David Gustafsson
Details | Diff | Splinter Review
Bug 39453: Schema changes (2.03 KB, patch)
2025-03-26 21:50 UTC, David Gustafsson
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Gustafsson 2025-03-25 20:23:52 UTC
This patch introduces a "readonly", "secret" and "hidden" setting for patron attribute types. All restrictions enforced by these new settings are not applied for superlibrarians, where attributes behave as if they have not been set. 

Readonly make the attributes of this type readonly, they appear on the patrons details page and when editing a patron, but their values can't be changed. Hidden attributes are not visible on the patrons details page or when editing a patron, but can for example be used internally. Secret attributes are basically the same thing as hidden, but the appear with their value masked in the patrons details page, and could be used for sensitive data not all staff members should have access to.

One use case (at our library) is to emulate a role based access control by having a number of reserved users as templates for roles. We then have a number of hidden attributes mapping users to these "roles", and a script running nightly that assigns permissions based on this mapping.
Comment 1 David Gustafsson 2025-03-25 20:45:08 UTC
Created attachment 179705 [details] [review]
Bug 39453: Add attribute type settings for restricting access to extended attributes

Add new attribute type settings "readonly", "secret" and "hidden" for
patron attribute types.

All restrictions enforced by these new settings are not applied for superlibrarians, where attributes behave as if they have not been set.

Readonly make the attributes of this type readonly, they appear on the patrons details page and when editing a patron, but their values can't be changed.

Hidden attributes are not visible on the patrons details page or when editing a patron, but can for example be used internally.

Secret attributes are basically the same thing as hidden, but the appear with their value masked in the patrons details page.

To Test:
1) Apply patch
3) Three new attribute type, each with one of the new settings set.
4) In addition to this create an attribute type which is a date, and set
   this to readonly.
5) As a superlibrarian, edit a patron and set values for the attributes of these types6) Log in as a non superlibrarian. Go to the same patron and verify that:
7) The attributes that are readonly can be viewd in the patrons details
   page, and when editing the patron, but their value can't be changed.
8) The hidden attribute should appear nowhere.
9) The secret attribute should be visible in the patrons details page,
   but masked. It should not appear when editing the patron.
10) Edit the patrons extended patron and save.
11) Log in as a superlibrarian, go to the patrons details page and
    verify the extended attribute values remains the same.

Sponsored-by: Gothenburg University Library
Comment 2 David Gustafsson 2025-03-25 20:45:11 UTC
Created attachment 179706 [details] [review]
Bug 39453: Schema changes
Comment 3 David Gustafsson 2025-03-26 21:50:04 UTC
Created attachment 179746 [details] [review]
Bug 39453: Add attribute type settings for restricting access to extended attributes

Add new attribute type settings "readonly", "secret" and "hidden" for
patron attribute types.

All restrictions enforced by these new settings are not applied for superlibrarians, where attributes behave as if they have not been set.

Readonly make the attributes of this type readonly, they appear on the patrons details page and when editing a patron, but their values can't be changed.

Hidden attributes are not visible on the patrons details page or when editing a patron, but can for example be used internally.

Secret attributes are basically the same thing as hidden, but the appear with their value masked in the patrons details page.

To Test:
1) Apply patch
3) Three new attribute type, each with one of the new settings set.
4) In addition to this create an attribute type which is a date, and set
   this to readonly.
5) As a superlibrarian, edit a patron and set values for the attributes of these types6) Log in as a non superlibrarian. Go to the same patron and verify that:
7) The attributes that are readonly can be viewd in the patrons details
   page, and when editing the patron, but their value can't be changed.
8) The hidden attribute should appear nowhere.
9) The secret attribute should be visible in the patrons details page,
   but masked. It should not appear when editing the patron.
10) Edit the patrons extended patron and save.
11) Log in as a superlibrarian, go to the patrons details page and
    verify the extended attribute values remains the same.

Sponsored-by: Gothenburg University Library
Comment 4 David Gustafsson 2025-03-26 21:50:07 UTC
Created attachment 179747 [details] [review]
Bug 39453: Schema changes