Bugzilla – Attachment 186540 Details for
Bug 20638
Add audit logging for API key actions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20638: Add ApiKeyLog system preference
Bug-20638-Add-ApiKeyLog-system-preference.patch (text/plain), 4.37 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-09-17 17:49:36 UTC
(
hide
)
Description:
Bug 20638: Add ApiKeyLog system preference
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-09-17 17:49:36 UTC
Size:
4.37 KB
patch
obsolete
>From 195308bfbc01f84fefd7d344f1f7a222eca2d03a Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= <tomascohen@theke.io> >Date: Wed, 17 Sep 2025 13:06:36 -0300 >Subject: [PATCH] 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) >--- > .../data/mysql/atomicupdate/bug_20638.pl | 20 +++++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 3 ++- > .../en/modules/admin/preferences/logs.pref | 6 ++++++ > 3 files changed, 28 insertions(+), 1 deletion(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_20638.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_20638.pl b/installer/data/mysql/atomicupdate/bug_20638.pl >new file mode 100755 >index 0000000000..2d1b8fc1f7 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_20638.pl >@@ -0,0 +1,20 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_failure say_success say_info); >+ >+return { >+ bug_number => "20638", >+ description => "Add ApiKeyLog system preference", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES >+ ('ApiKeyLog', '0', NULL, 'If ON, log API key creation, deletion, revocation and activation actions', 'YesNo') >+ } >+ ); >+ >+ say_success( $out, "Added new system preference 'ApiKeyLog'" ); >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index ea60db69b7..bdbbe0d3c7 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -63,6 +63,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('AmazonLocale','US','US|CA|DE|FR|IN|JP|UK','Use to set the Locale of your Amazon.com Web Services','Choice'), > ('AnonSuggestions','0',NULL,'Set to enable Anonymous suggestions to AnonymousPatron borrowernumber','YesNo'), > ('AnonymousPatron','0',NULL,'Set the identifier (borrowernumber) of the anonymous patron. Used for suggestion and checkout history privacy',''), >+('ApiKeyLog', '0', NULL, 'If enabled, log API key actions (create, revoke, activate, delete)', 'YesNo'), > ('ApplyFrameworkDefaults', 'new', 'new|duplicate|changed|imported', 'Configure when to apply framework default values - when cataloguing a new record, or when editing a record as new (duplicating), or when changing framework, or when importing a record', 'multiple'), > ('ArticleRequests', '0', NULL, 'Enables the article request feature', 'YesNo'), > ('ArticleRequestsLinkControl', 'calc', 'always|calc', 'Control display of article request link on search results', 'Choice'), >@@ -891,4 +892,4 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'), > ('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'), > ('z3950Status','','','This syspref allows to define custom YAML based rules for marking items unavailable in z3950 results.','Textarea') >-; >\ No newline at end of file >+; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >index 58679b4ab3..1861a0de4e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref >@@ -12,6 +12,12 @@ Logging: > 1: Log > 0: "Don't log" > - changes to patron records and patron restrictions. >+ - >+ - pref: ApiKeyLog >+ choices: >+ 1: Log >+ 0: "Don't log" >+ - API key creation, deletion, revocation and activation actions. > - > - pref: CardnumberLog > choices: >-- >2.51.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20638
: 186540 |
186541
|
186542
|
186543
|
186544