From 3cf81aa714c05a898413cd664087ab9d7379ca7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= 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) Signed-off-by: Paul Derscheid --- .../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 00000000000..2d1b8fc1f7e --- /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 ea60db69b7c..bdbbe0d3c79 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 58679b4ab32..1861a0de4e6 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.39.5