[Bug 20638] New: Log actions on API keys
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Bug ID: 20638 Summary: Log actions on API keys Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org Actions on API keys shoudl be logged and auditable (i.e. who creates the API keys, who revokes, etc). -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |20568 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20568 [Bug 20568] Add API key management interface for patrons -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Bug 20638 depends on bug 20568, which changed state. Bug 20568 Summary: Add API key management interface for patrons https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20568 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de Blocks| |22794 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22794 [Bug 22794] Omnibus: Improve and extend logging in Koha -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com, | |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew@bywatersolutions.com | |, dcook@prosentient.com.au, | |lisette@bywatersolutions.co | |m, | |martin.renvoize@openfifth.c | |o.uk, me@paulderscheid.xyz Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #1 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186540 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186540&action=edit Bug 20638: Add ApiKeyLog system preference This patch adds the ApiKeyLog system preference to control logging of API key actions (creation, deletion, revocation, activation). The preference follows the same pattern as BorrowersLog and other logging preferences. Test plan: 1. Apply patch and run database update 2. Go to Administration > System preferences > Logs 3. Verify ApiKeyLog preference appears with Yes/No options 4. Verify default value is 'Don't log' (0) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #2 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186541 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186541&action=edit Bug 20638: Add revoke() and activate() methods to Koha::ApiKey This patch adds two new methods to Koha::ApiKey: - revoke(): Sets active to 0, throws exception if already revoked - activate(): Sets active to 1, throws exception if already active Both methods include proper exception handling and comprehensive tests. Test plan: 1. prove t/db_dependent/Koha/ApiKey.t 2. Verify new subtests pass for revoke() and activate() methods 3. Confirm exceptions are thrown for invalid state transitions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #3 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186542 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186542&action=edit Bug 20638: Update apikeys.pl and template with proper exception handling This patch comprehensively updates the API keys management interface to use the new revoke() and activate() methods with proper exception handling. Controller changes (members/apikeys.pl): - Add Try::Tiny and Scalar::Util imports for exception handling - Replace direct field manipulation (active(0)/active(1)) with proper method calls (revoke()/activate()) to ensure logging - Wrap method calls in try/catch blocks to handle specific exceptions: * Koha::Exceptions::ApiKey::AlreadyRevoked * Koha::Exceptions::ApiKey::AlreadyActive - Implement standard Koha messages pattern with @messages array - Improve code structure with elsif chain instead of multiple if statements - Add proper error handling for key_not_found cases - Include error_string for unhandled exceptions to aid debugging Template changes (koha-tmpl/.../apikeys.tt): - Add comprehensive error message handling for all exception types: * already_revoked: Clear message for revoked keys * already_active: Clear message for active keys * key_not_found: Message for missing keys * unhandled_exception: Generic message with detailed error string Key benefits: - All API key state changes are now properly logged when ApiKeyLog is enabled - Better user experience with specific, actionable error messages - Robust exception handling prevents crashes and provides debugging info - Improved code maintainability and extensibility -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #4 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186543 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186543&action=edit Bug 20638: Add APIKEYS support to log viewer Add comprehensive support for viewing API key logs in the log viewer: tools/viewlog.pl: - Add APIKEYS to patron lookup logic alongside MEMBERS, CIRCULATION, FINES - Enable patron name display for API key log entries koha-tmpl/.../viewlog.tt: - Add APIKEYS to the modules list for filtering - Add ACTIVATE and REVOKE to the actions list for filtering - Include APIKEYS in patron display logic for object column koha-tmpl/.../action-logs.inc: - Add APIKEYS module translation: 'API keys' - Include ApiKeyLog system preference check with warning icon - Add ACTIVATE and REVOKE action translations - Maintain alphabetical order in translation blocks This enables librarians to view and filter API key creation, activation, revocation, and deletion activities in the standard log viewer interface, with proper patron name resolution and preference-based logging status indicators. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #5 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186544 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186544&action=edit Bug 20638: Include APIKEYS in 'Modification log' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Log actions on API keys |Add audit logging for API | |key actions CC| |evelyn@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186540|0 |1 is obsolete| | --- Comment #6 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 186558 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186558&action=edit Bug 20638: Add ApiKeyLog system preference This patch adds the ApiKeyLog system preference to control logging of API key actions (creation, deletion, revocation, activation). The preference follows the same pattern as BorrowersLog and other logging preferences. Test plan: 1. Apply patch and run database update 2. Go to Administration > System preferences > Logs 3. Verify ApiKeyLog preference appears with Yes/No options 4. Verify default value is 'Don't log' (0) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186541|0 |1 is obsolete| | --- Comment #7 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 186559 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186559&action=edit Bug 20638: Add revoke() and activate() methods to Koha::ApiKey This patch adds two new methods to Koha::ApiKey: - revoke(): Sets active to 0, throws exception if already revoked - activate(): Sets active to 1, throws exception if already active Both methods include proper exception handling and comprehensive tests. Test plan: 1. prove t/db_dependent/Koha/ApiKey.t 2. Verify new subtests pass for revoke() and activate() methods 3. Confirm exceptions are thrown for invalid state transitions Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186542|0 |1 is obsolete| | --- Comment #8 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 186560 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186560&action=edit Bug 20638: Update apikeys.pl and template with proper exception handling This patch comprehensively updates the API keys management interface to use the new revoke() and activate() methods with proper exception handling. Controller changes (members/apikeys.pl): - Add Try::Tiny and Scalar::Util imports for exception handling - Replace direct field manipulation (active(0)/active(1)) with proper method calls (revoke()/activate()) to ensure logging - Wrap method calls in try/catch blocks to handle specific exceptions: * Koha::Exceptions::ApiKey::AlreadyRevoked * Koha::Exceptions::ApiKey::AlreadyActive - Implement standard Koha messages pattern with @messages array - Improve code structure with elsif chain instead of multiple if statements - Add proper error handling for key_not_found cases - Include error_string for unhandled exceptions to aid debugging Template changes (koha-tmpl/.../apikeys.tt): - Add comprehensive error message handling for all exception types: * already_revoked: Clear message for revoked keys * already_active: Clear message for active keys * key_not_found: Message for missing keys * unhandled_exception: Generic message with detailed error string Key benefits: - All API key state changes are now properly logged when ApiKeyLog is enabled - Better user experience with specific, actionable error messages - Robust exception handling prevents crashes and provides debugging info - Improved code maintainability and extensibility Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186543|0 |1 is obsolete| | --- Comment #9 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 186561 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186561&action=edit Bug 20638: Add APIKEYS support to log viewer Add comprehensive support for viewing API key logs in the log viewer: tools/viewlog.pl: - Add APIKEYS to patron lookup logic alongside MEMBERS, CIRCULATION, FINES - Enable patron name display for API key log entries koha-tmpl/.../viewlog.tt: - Add APIKEYS to the modules list for filtering - Add ACTIVATE and REVOKE to the actions list for filtering - Include APIKEYS in patron display logic for object column koha-tmpl/.../action-logs.inc: - Add APIKEYS module translation: 'API keys' - Include ApiKeyLog system preference check with warning icon - Add ACTIVATE and REVOKE action translations - Maintain alphabetical order in translation blocks This enables librarians to view and filter API key creation, activation, revocation, and deletion activities in the standard log viewer interface, with proper patron name resolution and preference-based logging status indicators. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186544|0 |1 is obsolete| | --- Comment #10 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 186562 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186562&action=edit Bug 20638: Include APIKEYS in 'Modification log' Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paul.derscheid@lmscloud.de --- Comment #11 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Hi Tomás, this is awesome! qa script complains, though: qa Tag v25.05.00-1 found in /kohadevbox/koha — checking out branch main in /kohadevbox/qa-test-tools Already on 'main' Your branch is up to date with 'origin/main'. testing 5 commit(s) (applied to 1516f22 'f9c Bug 40665: Fix Cypress tests') Processing files [RUNNING] Koha/ApiKey.pm [RUNNING] Koha/Exceptions/ApiKey.pm [RUNNING] installer/data/mysql/atomicupdate/bug_20638.pl [RUNNING] installer/data/mysql/mandatory/sysprefs.sql [FAIL] installer/data/mysql/mandatory/sysprefs.sql [RUNNING] koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc [SKIP] Koha/Exceptions/ApiKey.pm [FAIL] installer/data/mysql/atomicupdate/bug_20638.pl [PASS] Koha/ApiKey.pm [RUNNING] koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc [RUNNING] koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref [RUNNING] koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt [PASS] koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref [PASS] koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc [RUNNING] koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt [RUNNING] members/apikeys.pl [PASS] koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc [RUNNING] t/db_dependent/Koha/ApiKey.t [PASS] koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt [PASS] members/apikeys.pl [PASS] koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt [RUNNING] tools/viewlog.pl [PASS] t/db_dependent/Koha/ApiKey.t [PASS] tools/viewlog.pl Result: [PASS] Koha/ApiKey.pm [SKIP] Koha/Exceptions/ApiKey.pm SKIP pod_coverage No POD exists [FAIL] installer/data/mysql/atomicupdate/bug_20638.pl FAIL forbidden_patterns forbidden pattern: Have you considered sharing the new syspref to HEA? (see bug 23849 and C4/UsageStats.pm) (line 13) [FAIL] installer/data/mysql/mandatory/sysprefs.sql FAIL semicolon semicolon found instead of comma at line 896 [PASS] koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc [PASS] koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc [PASS] koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref [PASS] koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt [PASS] koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt [PASS] members/apikeys.pl [PASS] t/db_dependent/Koha/ApiKey.t [PASS] tools/viewlog.pl Processing additional checks PASS! * Was this bug sponsored by anyone? Running tests (1) * Proving /kohadevbox/koha/t/db_dependent/Koha/ApiKey.t PASS -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #12 from Lisette Scheer <lisette@bywatersolutions.com> --- Additionally new logs need to use the diff https://wiki.koha-community.org/wiki/Coding_Guidelines#ACTN1:_New_additions_... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #13 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- (In reply to Paul Derscheid from comment #11)
Hi Tomás, this is awesome!
qa script complains, though
They all seem wrong checks. * Exceptions file contains POD, this check always fails. I think it is because our POD describes the various exceptions, which are defined inside the `use` statement. And there are no methods defined so... we might need to fix the QA tools or just not care about this particular error. * The semi-colon one I don't understand it. It is probably another QA script bug. * The HEA one I don't really understand it. I mentioned on the bug that it needs to be revisited. Probably as a warning and with different wording. (In reply to Lisette Scheer from comment #12)
Additionally new logs need to use the diff https://wiki.koha-community.org/wiki/Coding_Guidelines#ACTN1: _New_additions_to_actions_logs_should_use_the_JSON_Diff_format
Thanks for this one. I really didn't know about it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186558|0 |1 is obsolete| | --- Comment #14 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186577 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186577&action=edit Bug 20638: Add ApiKeyLog system preference This patch adds the ApiKeyLog system preference to control logging of API key actions (creation, deletion, revocation, activation). The preference follows the same pattern as BorrowersLog and other logging preferences. Test plan: 1. Apply patch and run database update 2. Go to Administration > System preferences > Logs 3. Verify ApiKeyLog preference appears with Yes/No options 4. Verify default value is 'Don't log' (0) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186559|0 |1 is obsolete| | --- Comment #15 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186578 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186578&action=edit Bug 20638: Add revoke() and activate() methods to Koha::ApiKey This patch adds two new methods to Koha::ApiKey: - revoke(): Sets active to 0, throws exception if already revoked - activate(): Sets active to 1, throws exception if already active Both methods include proper exception handling and comprehensive tests. Test plan: 1. prove t/db_dependent/Koha/ApiKey.t 2. Verify new subtests pass for revoke() and activate() methods 3. Confirm exceptions are thrown for invalid state transitions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186560|0 |1 is obsolete| | --- Comment #16 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186579 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186579&action=edit Bug 20638: Update apikeys.pl and template with proper exception handling This patch comprehensively updates the API keys management interface to use the new revoke() and activate() methods with proper exception handling. Controller changes (members/apikeys.pl): - Add Try::Tiny and Scalar::Util imports for exception handling - Replace direct field manipulation (active(0)/active(1)) with proper method calls (revoke()/activate()) to ensure logging - Wrap method calls in try/catch blocks to handle specific exceptions: * Koha::Exceptions::ApiKey::AlreadyRevoked * Koha::Exceptions::ApiKey::AlreadyActive - Implement standard Koha messages pattern with @messages array - Improve code structure with elsif chain instead of multiple if statements - Add proper error handling for key_not_found cases - Include error_string for unhandled exceptions to aid debugging Template changes (koha-tmpl/.../apikeys.tt): - Add comprehensive error message handling for all exception types: * already_revoked: Clear message for revoked keys * already_active: Clear message for active keys * key_not_found: Message for missing keys * unhandled_exception: Generic message with detailed error string Key benefits: - All API key state changes are now properly logged when ApiKeyLog is enabled - Better user experience with specific, actionable error messages - Robust exception handling prevents crashes and provides debugging info - Improved code maintainability and extensibility -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186561|0 |1 is obsolete| | --- Comment #17 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186580 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186580&action=edit Bug 20638: Add APIKEYS support to log viewer Add comprehensive support for viewing API key logs in the log viewer: tools/viewlog.pl: - Add APIKEYS to patron lookup logic alongside MEMBERS, CIRCULATION, FINES - Enable patron name display for API key log entries koha-tmpl/.../viewlog.tt: - Add APIKEYS to the modules list for filtering - Add ACTIVATE and REVOKE to the actions list for filtering - Include APIKEYS in patron display logic for object column koha-tmpl/.../action-logs.inc: - Add APIKEYS module translation: 'API keys' - Include ApiKeyLog system preference check with warning icon - Add ACTIVATE and REVOKE action translations - Maintain alphabetical order in translation blocks This enables librarians to view and filter API key creation, activation, revocation, and deletion activities in the standard log viewer interface, with proper patron name resolution and preference-based logging status indicators. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186562|0 |1 is obsolete| | --- Comment #18 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186581 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186581&action=edit Bug 20638: Include APIKEYS in 'Modification log' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #19 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186582 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186582&action=edit Bug 20638: Improve ApiKey logging to use structured data This patch enhances the ApiKey logging mechanism to pass structured object data instead of formatted strings to logaction(), following the ACTN1 coding guideline for action logs. Changes: - Pass the ApiKey object directly to logaction() for CREATE/REVOKE/ACTIVATE - Pass undef for info and the object in diff field for DELETE operations - Refactor store/revoke/activate methods to improve logging consistency - Update tests to handle the new structured logging format The new approach provides richer, more structured log data that can be better utilized by log analysis tools and maintains consistency with other Koha object logging patterns. Test plan: 1. Enable ApiKeyLog system preference 2. Create, revoke, activate, and delete API keys 3. Verify action_logs table contains structured object data 4. Run: $ ktd --shell k$ prove t/db_dependent/Koha/ApiKey.t => SUCCESS: Tests pass! 5. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186577|0 |1 is obsolete| | Attachment #186578|0 |1 is obsolete| | Attachment #186579|0 |1 is obsolete| | Attachment #186580|0 |1 is obsolete| | Attachment #186581|0 |1 is obsolete| | Attachment #186582|0 |1 is obsolete| | --- Comment #20 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186583 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186583&action=edit Bug 20638: Add ApiKeyLog system preference This patch adds the ApiKeyLog system preference to control logging of API key actions (creation, deletion, revocation, activation). The preference follows the same pattern as BorrowersLog and other logging preferences. Test plan: 1. Apply patch and run database update 2. Go to Administration > System preferences > Logs 3. Verify ApiKeyLog preference appears with Yes/No options 4. Verify default value is 'Don't log' (0) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #21 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186584 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186584&action=edit Bug 20638: Add revoke() and activate() methods to Koha::ApiKey This patch adds two new methods to Koha::ApiKey: - revoke(): Sets active to 0, throws exception if already revoked - activate(): Sets active to 1, throws exception if already active Both methods include proper exception handling and comprehensive tests. Test plan: 1. prove t/db_dependent/Koha/ApiKey.t 2. Verify new subtests pass for revoke() and activate() methods 3. Confirm exceptions are thrown for invalid state transitions Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #22 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186585 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186585&action=edit Bug 20638: Update apikeys.pl and template with proper exception handling This patch comprehensively updates the API keys management interface to use the new revoke() and activate() methods with proper exception handling. Controller changes (members/apikeys.pl): - Add Try::Tiny and Scalar::Util imports for exception handling - Replace direct field manipulation (active(0)/active(1)) with proper method calls (revoke()/activate()) to ensure logging - Wrap method calls in try/catch blocks to handle specific exceptions: * Koha::Exceptions::ApiKey::AlreadyRevoked * Koha::Exceptions::ApiKey::AlreadyActive - Implement standard Koha messages pattern with @messages array - Improve code structure with elsif chain instead of multiple if statements - Add proper error handling for key_not_found cases - Include error_string for unhandled exceptions to aid debugging Template changes (koha-tmpl/.../apikeys.tt): - Add comprehensive error message handling for all exception types: * already_revoked: Clear message for revoked keys * already_active: Clear message for active keys * key_not_found: Message for missing keys * unhandled_exception: Generic message with detailed error string Key benefits: - All API key state changes are now properly logged when ApiKeyLog is enabled - Better user experience with specific, actionable error messages - Robust exception handling prevents crashes and provides debugging info - Improved code maintainability and extensibility Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #23 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186586 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186586&action=edit Bug 20638: Add APIKEYS support to log viewer Add comprehensive support for viewing API key logs in the log viewer: tools/viewlog.pl: - Add APIKEYS to patron lookup logic alongside MEMBERS, CIRCULATION, FINES - Enable patron name display for API key log entries koha-tmpl/.../viewlog.tt: - Add APIKEYS to the modules list for filtering - Add ACTIVATE and REVOKE to the actions list for filtering - Include APIKEYS in patron display logic for object column koha-tmpl/.../action-logs.inc: - Add APIKEYS module translation: 'API keys' - Include ApiKeyLog system preference check with warning icon - Add ACTIVATE and REVOKE action translations - Maintain alphabetical order in translation blocks This enables librarians to view and filter API key creation, activation, revocation, and deletion activities in the standard log viewer interface, with proper patron name resolution and preference-based logging status indicators. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #24 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186587 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186587&action=edit Bug 20638: Include APIKEYS in 'Modification log' Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #25 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 186588 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186588&action=edit Bug 20638: Improve ApiKey logging to use structured data This patch enhances the ApiKey logging mechanism to pass structured object data instead of formatted strings to logaction(), following the ACTN1 coding guideline for action logs. Changes: - Pass the ApiKey object directly to logaction() for CREATE/REVOKE/ACTIVATE - Pass undef for info and the object in diff field for DELETE operations - Refactor store/revoke/activate methods to improve logging consistency - Update tests to handle the new structured logging format The new approach provides richer, more structured log data that can be better utilized by log analysis tools and maintains consistency with other Koha object logging patterns. Test plan: 1. Enable ApiKeyLog system preference 2. Create, revoke, activate, and delete API keys 3. Verify action_logs table contains structured object data 4. Run: $ ktd --shell k$ prove t/db_dependent/Koha/ApiKey.t => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |lisette@bywatersolutions.co |y.org |m -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #26 from Lisette Scheer <lisette@bywatersolutions.com> --- The info doesn't seem to be accurate, it's showing what it was before instead of what it is now (not sure if that's expected) and the just shows {} Create "$VAR1 = { 'active' => 1," Revoke "$VAR1 = { 'active' => 1," Activate" $VAR1 = { 'active' => 0," Cataloging log shoes before, but it shares that it's before: biblio BEFORE=> Patron log also shows before in the info { "middle_name" : { "after" : "middle name", "before" : null } } There's also some discussion on Bug 20956 about if the example in the ACTN1 is the way we should be doing this. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #186583|0 |1 is obsolete| | Attachment #186584|0 |1 is obsolete| | Attachment #186585|0 |1 is obsolete| | Attachment #186586|0 |1 is obsolete| | Attachment #186587|0 |1 is obsolete| | Attachment #186588|0 |1 is obsolete| | --- Comment #27 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 187004 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187004&action=edit Bug 20638: Add ApiKeyLog system preference This patch adds the ApiKeyLog system preference to control logging of API key actions (creation, deletion, revocation, activation). The preference follows the same pattern as BorrowersLog and other logging preferences. Test plan: 1. Apply patch and run database update 2. Go to Administration > System preferences > Logs 3. Verify ApiKeyLog preference appears with Yes/No options 4. Verify default value is 'Don't log' (0) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #28 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 187005 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187005&action=edit Bug 20638: Add revoke() and activate() methods to Koha::ApiKey This patch adds two new methods to Koha::ApiKey: - revoke(): Sets active to 0, throws exception if already revoked - activate(): Sets active to 1, throws exception if already active Both methods include proper exception handling and comprehensive tests. Test plan: 1. prove t/db_dependent/Koha/ApiKey.t 2. Verify new subtests pass for revoke() and activate() methods 3. Confirm exceptions are thrown for invalid state transitions Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #29 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 187006 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187006&action=edit Bug 20638: Update apikeys.pl and template with proper exception handling This patch comprehensively updates the API keys management interface to use the new revoke() and activate() methods with proper exception handling. Controller changes (members/apikeys.pl): - Add Try::Tiny and Scalar::Util imports for exception handling - Replace direct field manipulation (active(0)/active(1)) with proper method calls (revoke()/activate()) to ensure logging - Wrap method calls in try/catch blocks to handle specific exceptions: * Koha::Exceptions::ApiKey::AlreadyRevoked * Koha::Exceptions::ApiKey::AlreadyActive - Implement standard Koha messages pattern with @messages array - Improve code structure with elsif chain instead of multiple if statements - Add proper error handling for key_not_found cases - Include error_string for unhandled exceptions to aid debugging Template changes (koha-tmpl/.../apikeys.tt): - Add comprehensive error message handling for all exception types: * already_revoked: Clear message for revoked keys * already_active: Clear message for active keys * key_not_found: Message for missing keys * unhandled_exception: Generic message with detailed error string Key benefits: - All API key state changes are now properly logged when ApiKeyLog is enabled - Better user experience with specific, actionable error messages - Robust exception handling prevents crashes and provides debugging info - Improved code maintainability and extensibility Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #30 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 187007 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187007&action=edit Bug 20638: Add APIKEYS support to log viewer Add comprehensive support for viewing API key logs in the log viewer: tools/viewlog.pl: - Add APIKEYS to patron lookup logic alongside MEMBERS, CIRCULATION, FINES - Enable patron name display for API key log entries koha-tmpl/.../viewlog.tt: - Add APIKEYS to the modules list for filtering - Add ACTIVATE and REVOKE to the actions list for filtering - Include APIKEYS in patron display logic for object column koha-tmpl/.../action-logs.inc: - Add APIKEYS module translation: 'API keys' - Include ApiKeyLog system preference check with warning icon - Add ACTIVATE and REVOKE action translations - Maintain alphabetical order in translation blocks This enables librarians to view and filter API key creation, activation, revocation, and deletion activities in the standard log viewer interface, with proper patron name resolution and preference-based logging status indicators. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #31 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 187008 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187008&action=edit Bug 20638: Include APIKEYS in 'Modification log' Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #32 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 187009 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187009&action=edit Bug 20638: Improve ApiKey logging to use structured data This patch enhances the ApiKey logging mechanism to pass structured object data instead of formatted strings to logaction(), following the ACTN1 coding guideline for action logs. Changes: - Pass the ApiKey object directly to logaction() for CREATE/REVOKE/ACTIVATE - Pass undef for info and the object in diff field for DELETE operations - Refactor store/revoke/activate methods to improve logging consistency - Update tests to handle the new structured logging format The new approach provides richer, more structured log data that can be better utilized by log analysis tools and maintains consistency with other Koha object logging patterns. Test plan: 1. Enable ApiKeyLog system preference 2. Create, revoke, activate, and delete API keys 3. Verify action_logs table contains structured object data 4. Run: $ ktd --shell k$ prove t/db_dependent/Koha/ApiKey.t => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #33 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 187011 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187011&action=edit Bug 20638: (follow-up) Silence viewlog.pl warning This patch fixes useless warnings being printed by `viewlog.pl` I noticed while testing this new feature. To test: 1. Test the feature introduced by this patchset 2. Make sure you are running: $ ktd --shell k$ tail -f /var/log/koha/kohadev/*.log => FAIL: You see things like: ``` [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:43:44] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:43:44] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. ``` 3. Refresh the viewlog page => FAIL: They are consistent 4. Apply this patch 5. Repeat 3 => SUCCESS: No more warnings! 6. Sign off :-D Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #34 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Thanks Lisette for testing! I found out the `C4::Log::actionlog` method is actually performing an implicit `$infos->get_from_storage()` which breaks the logic I implemented, as my original implementation was: 1. modify the object ($self) 2. create an unmodified copy of the object ($self->get_from_storage) [1] 3. pass both to `logaction()` 4. call `store()` So it was always comparing the untouched object with itself, even though I was passing a modified one! I changed it to match what `actionlog` is designed to, even though I dislike this a lot :-D. About [1] I opted to use `clone` and save a DB query. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- 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=20638 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187004|0 |1 is obsolete| | --- Comment #35 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 187020 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187020&action=edit Bug 20638: Add ApiKeyLog system preference This patch adds the ApiKeyLog system preference to control logging of API key actions (creation, deletion, revocation, activation). The preference follows the same pattern as BorrowersLog and other logging preferences. Test plan: 1. Apply patch and run database update 2. Go to Administration > System preferences > Logs 3. Verify ApiKeyLog preference appears with Yes/No options 4. Verify default value is 'Don't log' (0) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187005|0 |1 is obsolete| | --- Comment #36 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 187021 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187021&action=edit Bug 20638: Add revoke() and activate() methods to Koha::ApiKey This patch adds two new methods to Koha::ApiKey: - revoke(): Sets active to 0, throws exception if already revoked - activate(): Sets active to 1, throws exception if already active Both methods include proper exception handling and comprehensive tests. Test plan: 1. prove t/db_dependent/Koha/ApiKey.t 2. Verify new subtests pass for revoke() and activate() methods 3. Confirm exceptions are thrown for invalid state transitions Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187006|0 |1 is obsolete| | --- Comment #37 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 187022 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187022&action=edit Bug 20638: Update apikeys.pl and template with proper exception handling This patch comprehensively updates the API keys management interface to use the new revoke() and activate() methods with proper exception handling. Controller changes (members/apikeys.pl): - Add Try::Tiny and Scalar::Util imports for exception handling - Replace direct field manipulation (active(0)/active(1)) with proper method calls (revoke()/activate()) to ensure logging - Wrap method calls in try/catch blocks to handle specific exceptions: * Koha::Exceptions::ApiKey::AlreadyRevoked * Koha::Exceptions::ApiKey::AlreadyActive - Implement standard Koha messages pattern with @messages array - Improve code structure with elsif chain instead of multiple if statements - Add proper error handling for key_not_found cases - Include error_string for unhandled exceptions to aid debugging Template changes (koha-tmpl/.../apikeys.tt): - Add comprehensive error message handling for all exception types: * already_revoked: Clear message for revoked keys * already_active: Clear message for active keys * key_not_found: Message for missing keys * unhandled_exception: Generic message with detailed error string Key benefits: - All API key state changes are now properly logged when ApiKeyLog is enabled - Better user experience with specific, actionable error messages - Robust exception handling prevents crashes and provides debugging info - Improved code maintainability and extensibility Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187007|0 |1 is obsolete| | --- Comment #38 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 187023 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187023&action=edit Bug 20638: Add APIKEYS support to log viewer Add comprehensive support for viewing API key logs in the log viewer: tools/viewlog.pl: - Add APIKEYS to patron lookup logic alongside MEMBERS, CIRCULATION, FINES - Enable patron name display for API key log entries koha-tmpl/.../viewlog.tt: - Add APIKEYS to the modules list for filtering - Add ACTIVATE and REVOKE to the actions list for filtering - Include APIKEYS in patron display logic for object column koha-tmpl/.../action-logs.inc: - Add APIKEYS module translation: 'API keys' - Include ApiKeyLog system preference check with warning icon - Add ACTIVATE and REVOKE action translations - Maintain alphabetical order in translation blocks This enables librarians to view and filter API key creation, activation, revocation, and deletion activities in the standard log viewer interface, with proper patron name resolution and preference-based logging status indicators. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187008|0 |1 is obsolete| | --- Comment #39 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 187024 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187024&action=edit Bug 20638: Include APIKEYS in 'Modification log' Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187009|0 |1 is obsolete| | --- Comment #40 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 187025 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187025&action=edit Bug 20638: Improve ApiKey logging to use structured data This patch enhances the ApiKey logging mechanism to pass structured object data instead of formatted strings to logaction(), following the ACTN1 coding guideline for action logs. Changes: - Pass the ApiKey object directly to logaction() for CREATE/REVOKE/ACTIVATE - Pass undef for info and the object in diff field for DELETE operations - Refactor store/revoke/activate methods to improve logging consistency - Update tests to handle the new structured logging format The new approach provides richer, more structured log data that can be better utilized by log analysis tools and maintains consistency with other Koha object logging patterns. Test plan: 1. Enable ApiKeyLog system preference 2. Create, revoke, activate, and delete API keys 3. Verify action_logs table contains structured object data 4. Run: $ ktd --shell k$ prove t/db_dependent/Koha/ApiKey.t => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187011|0 |1 is obsolete| | --- Comment #41 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 187026 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187026&action=edit Bug 20638: (follow-up) Silence viewlog.pl warning This patch fixes useless warnings being printed by `viewlog.pl` I noticed while testing this new feature. To test: 1. Test the feature introduced by this patchset 2. Make sure you are running: $ ktd --shell k$ tail -f /var/log/koha/kohadev/*.log => FAIL: You see things like: ``` [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:43:44] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:43:44] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. ``` 3. Refresh the viewlog page => FAIL: They are consistent 4. Apply this patch 5. Repeat 3 => SUCCESS: No more warnings! 6. Sign off :-D Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Keywords| |release-notes-needed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Signed Off --- Comment #42 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Sorry, I think I have to ask more an additional external QA stamp here. Or if Paul is willing to trade SO/QA with Lisette that would work. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #43 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- (In reply to Lucas Gass (lukeg) from comment #42)
Sorry, I think I have to ask more an additional external QA stamp here. Or if Paul is willing to trade SO/QA with Lisette that would work.
When I say external, I mean I would like a non-ByWater QA here. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|lisette@bywatersolutions.co |testopia@bugs.koha-communit |m |y.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #44 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 189658 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189658&action=edit Bug 20638: Add ApiKeyLog system preference This patch adds the ApiKeyLog system preference to control logging of API key actions (creation, deletion, revocation, activation). The preference follows the same pattern as BorrowersLog and other logging preferences. Test plan: 1. Apply patch and run database update 2. Go to Administration > System preferences > Logs 3. Verify ApiKeyLog preference appears with Yes/No options 4. Verify default value is 'Don't log' (0) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #45 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 189659 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189659&action=edit Bug 20638: Add revoke() and activate() methods to Koha::ApiKey This patch adds two new methods to Koha::ApiKey: - revoke(): Sets active to 0, throws exception if already revoked - activate(): Sets active to 1, throws exception if already active Both methods include proper exception handling and comprehensive tests. Test plan: 1. prove t/db_dependent/Koha/ApiKey.t 2. Verify new subtests pass for revoke() and activate() methods 3. Confirm exceptions are thrown for invalid state transitions Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #46 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 189660 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189660&action=edit Bug 20638: Update apikeys.pl and template with proper exception handling This patch comprehensively updates the API keys management interface to use the new revoke() and activate() methods with proper exception handling. Controller changes (members/apikeys.pl): - Add Try::Tiny and Scalar::Util imports for exception handling - Replace direct field manipulation (active(0)/active(1)) with proper method calls (revoke()/activate()) to ensure logging - Wrap method calls in try/catch blocks to handle specific exceptions: * Koha::Exceptions::ApiKey::AlreadyRevoked * Koha::Exceptions::ApiKey::AlreadyActive - Implement standard Koha messages pattern with @messages array - Improve code structure with elsif chain instead of multiple if statements - Add proper error handling for key_not_found cases - Include error_string for unhandled exceptions to aid debugging Template changes (koha-tmpl/.../apikeys.tt): - Add comprehensive error message handling for all exception types: * already_revoked: Clear message for revoked keys * already_active: Clear message for active keys * key_not_found: Message for missing keys * unhandled_exception: Generic message with detailed error string Key benefits: - All API key state changes are now properly logged when ApiKeyLog is enabled - Better user experience with specific, actionable error messages - Robust exception handling prevents crashes and provides debugging info - Improved code maintainability and extensibility Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #47 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 189661 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189661&action=edit Bug 20638: Add APIKEYS support to log viewer Add comprehensive support for viewing API key logs in the log viewer: tools/viewlog.pl: - Add APIKEYS to patron lookup logic alongside MEMBERS, CIRCULATION, FINES - Enable patron name display for API key log entries koha-tmpl/.../viewlog.tt: - Add APIKEYS to the modules list for filtering - Add ACTIVATE and REVOKE to the actions list for filtering - Include APIKEYS in patron display logic for object column koha-tmpl/.../action-logs.inc: - Add APIKEYS module translation: 'API keys' - Include ApiKeyLog system preference check with warning icon - Add ACTIVATE and REVOKE action translations - Maintain alphabetical order in translation blocks This enables librarians to view and filter API key creation, activation, revocation, and deletion activities in the standard log viewer interface, with proper patron name resolution and preference-based logging status indicators. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #48 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 189662 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189662&action=edit Bug 20638: Include APIKEYS in 'Modification log' Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #49 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 189663 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189663&action=edit Bug 20638: Improve ApiKey logging to use structured data This patch enhances the ApiKey logging mechanism to pass structured object data instead of formatted strings to logaction(), following the ACTN1 coding guideline for action logs. Changes: - Pass the ApiKey object directly to logaction() for CREATE/REVOKE/ACTIVATE - Pass undef for info and the object in diff field for DELETE operations - Refactor store/revoke/activate methods to improve logging consistency - Update tests to handle the new structured logging format The new approach provides richer, more structured log data that can be better utilized by log analysis tools and maintains consistency with other Koha object logging patterns. Test plan: 1. Enable ApiKeyLog system preference 2. Create, revoke, activate, and delete API keys 3. Verify action_logs table contains structured object data 4. Run: $ ktd --shell k$ prove t/db_dependent/Koha/ApiKey.t => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #50 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 189664 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189664&action=edit Bug 20638: (follow-up) Silence viewlog.pl warning This patch fixes useless warnings being printed by `viewlog.pl` I noticed while testing this new feature. To test: 1. Test the feature introduced by this patchset 2. Make sure you are running: $ ktd --shell k$ tail -f /var/log/koha/kohadev/*.log => FAIL: You see things like: ``` [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:43:44] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:43:44] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. ``` 3. Refresh the viewlog page => FAIL: They are consistent 4. Apply this patch 5. Repeat 3 => SUCCESS: No more warnings! 6. Sign off :-D Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187020|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=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187021|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=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187022|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=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187023|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=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187024|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=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187025|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=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187026|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=20638 --- Comment #51 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 189665 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189665&action=edit Bug 20638: Add ApiKeyLog system preference This patch adds the ApiKeyLog system preference to control logging of API key actions (creation, deletion, revocation, activation). The preference follows the same pattern as BorrowersLog and other logging preferences. Test plan: 1. Apply patch and run database update 2. Go to Administration > System preferences > Logs 3. Verify ApiKeyLog preference appears with Yes/No options 4. Verify default value is 'Don't log' (0) Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #52 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 189666 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189666&action=edit Bug 20638: Add revoke() and activate() methods to Koha::ApiKey This patch adds two new methods to Koha::ApiKey: - revoke(): Sets active to 0, throws exception if already revoked - activate(): Sets active to 1, throws exception if already active Both methods include proper exception handling and comprehensive tests. Test plan: 1. prove t/db_dependent/Koha/ApiKey.t 2. Verify new subtests pass for revoke() and activate() methods 3. Confirm exceptions are thrown for invalid state transitions Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #53 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 189667 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189667&action=edit Bug 20638: Update apikeys.pl and template with proper exception handling This patch comprehensively updates the API keys management interface to use the new revoke() and activate() methods with proper exception handling. Controller changes (members/apikeys.pl): - Add Try::Tiny and Scalar::Util imports for exception handling - Replace direct field manipulation (active(0)/active(1)) with proper method calls (revoke()/activate()) to ensure logging - Wrap method calls in try/catch blocks to handle specific exceptions: * Koha::Exceptions::ApiKey::AlreadyRevoked * Koha::Exceptions::ApiKey::AlreadyActive - Implement standard Koha messages pattern with @messages array - Improve code structure with elsif chain instead of multiple if statements - Add proper error handling for key_not_found cases - Include error_string for unhandled exceptions to aid debugging Template changes (koha-tmpl/.../apikeys.tt): - Add comprehensive error message handling for all exception types: * already_revoked: Clear message for revoked keys * already_active: Clear message for active keys * key_not_found: Message for missing keys * unhandled_exception: Generic message with detailed error string Key benefits: - All API key state changes are now properly logged when ApiKeyLog is enabled - Better user experience with specific, actionable error messages - Robust exception handling prevents crashes and provides debugging info - Improved code maintainability and extensibility Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #54 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 189668 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189668&action=edit Bug 20638: Add APIKEYS support to log viewer Add comprehensive support for viewing API key logs in the log viewer: tools/viewlog.pl: - Add APIKEYS to patron lookup logic alongside MEMBERS, CIRCULATION, FINES - Enable patron name display for API key log entries koha-tmpl/.../viewlog.tt: - Add APIKEYS to the modules list for filtering - Add ACTIVATE and REVOKE to the actions list for filtering - Include APIKEYS in patron display logic for object column koha-tmpl/.../action-logs.inc: - Add APIKEYS module translation: 'API keys' - Include ApiKeyLog system preference check with warning icon - Add ACTIVATE and REVOKE action translations - Maintain alphabetical order in translation blocks This enables librarians to view and filter API key creation, activation, revocation, and deletion activities in the standard log viewer interface, with proper patron name resolution and preference-based logging status indicators. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #55 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 189669 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189669&action=edit Bug 20638: Include APIKEYS in 'Modification log' Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #56 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 189670 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189670&action=edit Bug 20638: Improve ApiKey logging to use structured data This patch enhances the ApiKey logging mechanism to pass structured object data instead of formatted strings to logaction(), following the ACTN1 coding guideline for action logs. Changes: - Pass the ApiKey object directly to logaction() for CREATE/REVOKE/ACTIVATE - Pass undef for info and the object in diff field for DELETE operations - Refactor store/revoke/activate methods to improve logging consistency - Update tests to handle the new structured logging format The new approach provides richer, more structured log data that can be better utilized by log analysis tools and maintains consistency with other Koha object logging patterns. Test plan: 1. Enable ApiKeyLog system preference 2. Create, revoke, activate, and delete API keys 3. Verify action_logs table contains structured object data 4. Run: $ ktd --shell k$ prove t/db_dependent/Koha/ApiKey.t => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #57 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 189671 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189671&action=edit Bug 20638: (follow-up) Silence viewlog.pl warning This patch fixes useless warnings being printed by `viewlog.pl` I noticed while testing this new feature. To test: 1. Test the feature introduced by this patchset 2. Make sure you are running: $ ktd --shell k$ tail -f /var/log/koha/kohadev/*.log => FAIL: You see things like: ``` [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:43:44] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. [2025/09/26 18:43:44] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156. ``` 3. Refresh the viewlog page => FAIL: They are consistent 4. Apply this patch 5. Repeat 3 => SUCCESS: No more warnings! 6. Sign off :-D Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189658|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=20638 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189659|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=20638 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189660|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=20638 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189661|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=20638 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189662|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=20638 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189663|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=20638 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189664|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=20638 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- 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=20638 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |martin.renvoize@openfifth.c |y.org |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_26_05_candidate -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Emmi Takkinen <emmi.takkinen@koha-suomi.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |emmi.takkinen@koha-suomi.fi --- Comment #58 from Emmi Takkinen <emmi.takkinen@koha-suomi.fi> --- We just tested this and noticed that now API secret and client_id are displayed on patrons modification log. Currently secret is not displayed on Koha and is only viewable from database. Not saying this is a blocker but we were just thinking can this cause security issues? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.05.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #59 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 26.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_26_05_candidate | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 --- Comment #60 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- please add release notes -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Needs documenting --- Comment #61 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- This bug won't be backported to the 25.11.x branch as it has been deemed an enhancement or new feature. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20638 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|release-notes-needed | -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org