https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44213

--- Comment #2 from Andrew Fuerste-Henry <[email protected]> ---
Created attachment 212332
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212332&action=edit
Bug 44213: List account permissions on SIP account page

When viewing a SIP2 account it is useful to see which permissions the
associated staff user has, since SIP2 transactions run with them.

This patch adds:
- Koha::SIP2::Account->patron_permissions, returning the permissions
  granted to the patron linked through login_id as a sorted list of
  { module, subpermissions } entries (subpermissions is null when the
  whole module is granted)
- a 'patron_permissions' embed on GET /sip2/accounts and
  /sip2/accounts/{id}
- a read-only "Staff user permissions" row on the SIP2 account page,
  directly below the staff userid. Modules granted in full are listed by
  their module code; where only some subpermissions of a module are
  granted, only those subpermission codes are listed, e.g.
  "circulate, edit_calendar, export_catalog", or "None"

The row is not shown when login_id matches no patron.

Test plan:
1. Go to Administration > SIP2 > Accounts and view an account whose
   login is an existing staff patron's userid
2. Apply the patch, run yarn build and restart_all
3. View the account again: a "Staff user permissions" row lists the
   patron's permissions
4. Give the patron a subpermission without its module (e.g.
   advanced_editor without editcatalogue): only "advanced_editor" is
   listed, not "editcatalogue"
5. Change the patron's permissions (Patrons > More > Set permissions)
   and reload the account page: the row reflects the change
6. Remove all of the patron's permissions: the row shows "None"
7. Edit and save the account: it still saves correctly, and the row
   does not appear in the edit form or the accounts list
8. prove t/db_dependent/Koha/SIP2/Accounts.t
   prove t/db_dependent/api/v1/sip2_accounts.t

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Signed-off-by: Barbara Johnson <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to