From 69d25cc914cff9d976eb6a2773ba0ca5846707fd 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 | 1 + .../en/modules/admin/preferences/logs.pref | 6 ++++++ 3 files changed, 27 insertions(+) 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 7fb46c297e..8dfd87e839 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'), 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