Bugzilla – Attachment 106255 Details for
Bug 24151
Add a pseudonymization process for patrons and transactions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24151: Rename the config key with 'bcrypt_settings'
Bug-24151-Rename-the-config-key-with-bcryptsetting.patch (text/plain), 10.11 KB, created by
Jonathan Druart
on 2020-06-24 14:45:28 UTC
(
hide
)
Description:
Bug 24151: Rename the config key with 'bcrypt_settings'
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-06-24 14:45:28 UTC
Size:
10.11 KB
patch
obsolete
>From 9ff15e63ba7df5ed0c0b55dfb0047ff8cc6b57cc Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 24 Jun 2020 16:45:12 +0200 >Subject: [PATCH] Bug 24151: Rename the config key with 'bcrypt_settings' > >--- > Koha/PseudonymizedTransaction.pm | 8 ++++---- > about.pl | 6 +++--- > debian/scripts/koha-create | 4 ++-- > debian/templates/koha-conf-site.xml.in | 4 ++-- > etc/koha-conf.xml | 4 ++-- > koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 8 ++++---- > t/db_dependent/Koha/Pseudonymization.t | 10 +++++----- > 7 files changed, 22 insertions(+), 22 deletions(-) > >diff --git a/Koha/PseudonymizedTransaction.pm b/Koha/PseudonymizedTransaction.pm >index 4af91169ad..78a1190f7c 100644 >--- a/Koha/PseudonymizedTransaction.pm >+++ b/Koha/PseudonymizedTransaction.pm >@@ -103,18 +103,18 @@ sub new_from_statistic { > =head3 get_hash > > Generates a hashed value for $s (e.g. borrowernumber) with Bcrypt. >- Needs config entry 'key' in koha-conf. >+ Needs config entry 'bcrypt_settings' in koha-conf. > > =cut > > sub get_hash { > my ( $class, $s ) = @_; >- my $key = C4::Context->config('key'); >+ my $bcrypt_settings = C4::Context->config('bcrypt_settings'); > > Koha::Exceptions::Config::MissingEntry->throw( >- "Missing 'key' entry in config file") unless $key; >+ "Missing 'bcrypt_settings' entry in config file") unless $bcrypt_settings; > >- return bcrypt($s, $key); >+ return bcrypt($s, $bcrypt_settings); > } > > =head2 Internal methods >diff --git a/about.pl b/about.pl >index de0a6c5fa4..d624246d6b 100755 >--- a/about.pl >+++ b/about.pl >@@ -519,10 +519,10 @@ $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; > } > > { >- # Test 'key' config for Pseudonymization >- $template->param( config_key_no_set => 1 ) >+ # Test 'bcrypt_settings' config for Pseudonymization >+ $template->param( config_bcrypt_settings_no_set => 1 ) > if C4::Context->preference('Pseudonymization') >- and not C4::Context->config('key'); >+ and not C4::Context->config('bcrypt_settings'); > } > > my %versions = C4::Context::get_versions(); >diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create >index 5cc3f2ffc4..390879f37f 100755 >--- a/debian/scripts/koha-create >+++ b/debian/scripts/koha-create >@@ -111,7 +111,7 @@ generate_config_file() { > -e "s/__UNIXGROUP__/$username/g" \ > -e "s#__TEMPLATE_CACHE_DIR__#$TEMPLATE_CACHE_DIR#g" \ > -e "s#__TIMEZONE__#$TIMEZONE#g" \ >- -e "s#__KEY__#$KEY#g" \ >+ -e "s#__BCRYPT_SETTINGS__#$BCRYPT_SETTINGS#g" \ > -e "s#__UPLOAD_PATH__#$UPLOAD_PATH#g" \ > -e "s#__TMP_PATH__#$TMP_PATH#g" \ > -e "s/__LOG_DIR__/\/var\/log\/koha\/$name/g" \ >@@ -496,7 +496,7 @@ if [ "${CLO_ELASTICSEARCH_SERVER}" != "" ]; then > ELASTICSEARCH_SERVER="${CLO_ELASTICSEARCH_SERVER}" > fi > >-KEY=$(htpasswd -bnBC 10 "" password | tr -d ':\n' | sed 's/$2y/$2a/'); >+BCRYPT_SETTINGS=$(htpasswd -bnBC 10 "" password | tr -d ':\n' | sed 's/$2y/$2a/'); > > > if [ "$ENABLE_SRU" != "no" ]; then >diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in >index 099a65b5bf..4853018b1f 100644 >--- a/debian/templates/koha-conf-site.xml.in >+++ b/debian/templates/koha-conf-site.xml.in >@@ -403,8 +403,8 @@ __END_SRU_PUBLICSERVER__ > server. e.g. Antarctica/South_Pole --> > <timezone>__TIMEZONE__</timezone> > >- <!-- This is the salt used to generated anonymized content --> >- <key>__KEY__</key> >+ <!-- This is the bcryt settings used to generated anonymized content --> >+ <key>__BCRYPT_SETTINGS__</key> > > <!-- flag for development purposes > dev_install is used to adjust some paths specific to dev installations >diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml >index f3697ed6e0..2ffe624a8c 100644 >--- a/etc/koha-conf.xml >+++ b/etc/koha-conf.xml >@@ -227,8 +227,8 @@ __PAZPAR2_TOGGLE_XML_POST__ > server. e.g. Antarctica/South_Pole --> > <timezone></timezone> > >- <!-- This is the salt used to generated anonymized content --> >- <key>__KEY__</key> >+ <!-- This is the bcryt settings used to generated anonymized content --> >+ <key>__BCRYPT_SETTINGS__</key> > > <!-- flag for development purposes > dev_install is used to adjust some paths specific to dev installations >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >index efbb473579..866925b812 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >@@ -184,7 +184,7 @@ > </div> > > <div id="sysinfo"> >- [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnNoActiveCurrency || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships || log4perl_errors || config_key_no_set %] >+ [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnNoActiveCurrency || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships || log4perl_errors || config_bcrypt_settings_no_set %] > [% IF (warnIsRootUser) %] > <h2>Warning regarding current user</h2> > <p>You are logged in as the database administrative user. This is not recommended because some parts of Koha will not function as expected when using this account.</p> >@@ -259,7 +259,7 @@ > [% END %] > [% END %] > >- [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnNoActiveCurrency || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || oauth2_missing_deps || bad_yaml_prefs || warnIssuingRules || config_key_no_set %] >+ [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnNoActiveCurrency || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || oauth2_missing_deps || bad_yaml_prefs || warnIssuingRules || config_bcrypt_settings_no_set %] > <h2>Warnings regarding the system configuration</h2> > <table> > <caption>Preferences and parameters</caption> >@@ -335,9 +335,9 @@ > Some system preferences have badly formatted YAML content: [% bad_yaml_prefs.join(', ') | html %] > </td></tr> > [% END %] >- [% IF config_key_no_set %] >+ [% IF config_bcrypt_settings_no_set %] > <tr><th scope="row"><b>Warning</b> </th><td> >- System preference 'Pseudonymization' is set, but there is not 'key' entry defined in the $KOHA_CONF file. >+ System preference 'Pseudonymization' is set, but there is not 'bcrypt_settings' entry defined in the $KOHA_CONF file. > </td></tr> > [% END %] > </table> >diff --git a/t/db_dependent/Koha/Pseudonymization.t b/t/db_dependent/Koha/Pseudonymization.t >index b1d12ad0ab..cfefc82292 100644 >--- a/t/db_dependent/Koha/Pseudonymization.t >+++ b/t/db_dependent/Koha/Pseudonymization.t >@@ -42,7 +42,7 @@ subtest 'Config does not exist' => sub { > > $schema->storage->txn_begin; > >- t::lib::Mocks::mock_config( 'key', '' ); >+ t::lib::Mocks::mock_config( 'bcrypt_settings', '' ); > t::lib::Mocks::mock_preference( 'Pseudonymization', 1 ); > t::lib::Mocks::mock_preference( 'PseudonymizationPatronFields', 'branchcode,categorycode,sort1' ); > >@@ -64,8 +64,8 @@ subtest 'Config does not exist' => sub { > ); > > } catch { >- ok($_->isa('Koha::Exceptions::Config::MissingEntry'), "Koha::Patron->store should raise a Koha::Exceptions::Config::MissingEntry if 'key' is not defined in the config"); >- is( $_->message, "Missing 'key' entry in config file"); >+ ok($_->isa('Koha::Exceptions::Config::MissingEntry'), "Koha::Patron->store should raise a Koha::Exceptions::Config::MissingEntry if 'bcrypt_settings' is not defined in the config"); >+ is( $_->message, "Missing 'bcrypt_settings' entry in config file"); > }; > > $schema->storage->txn_rollback; >@@ -77,7 +77,7 @@ subtest 'Koha::Anonymized::Transactions tests' => sub { > > $schema->storage->txn_begin; > >- t::lib::Mocks::mock_config( 'key', '$2a$08$9lmorEKnwQloheaCLFIfje' ); >+ t::lib::Mocks::mock_config( 'bcrypt_settings', '$2a$08$9lmorEKnwQloheaCLFIfje' ); > > my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); > >@@ -122,7 +122,7 @@ subtest 'PseudonymizedBorrowerAttributes tests' => sub { > > $schema->storage->txn_begin; > >- t::lib::Mocks::mock_config( 'key', '$2a$08$9lmorEKnwQloheaCLFIfje' ); >+ t::lib::Mocks::mock_config( 'bcrypt_settings', '$2a$08$9lmorEKnwQloheaCLFIfje' ); > t::lib::Mocks::mock_preference( 'Pseudonymization', 1 ); > t::lib::Mocks::mock_preference( 'PseudonymizationPatronFields', > 'branchcode,categorycode,sort1' ); >-- >2.20.1
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 24151
:
95959
|
95960
|
95961
|
95962
|
95963
|
95964
|
95965
|
95966
|
95967
|
95968
|
95969
|
95970
|
95971
|
95972
|
95973
|
95974
|
95975
|
95976
|
97240
|
97241
|
97242
|
97243
|
97244
|
97245
|
97246
|
97247
|
97248
|
97249
|
97250
|
97251
|
97252
|
101034
|
101035
|
101036
|
101037
|
101038
|
101039
|
101040
|
101041
|
101042
|
101043
|
101044
|
101045
|
101046
|
101047
|
101048
|
101049
|
105801
|
105802
|
105803
|
105804
|
105805
|
105806
|
105807
|
105808
|
105809
|
105810
|
105811
|
105812
|
105813
|
105814
|
105815
|
105816
|
106032
|
106033
|
106034
|
106035
|
106036
|
106037
|
106038
|
106039
|
106040
|
106041
|
106042
|
106043
|
106044
|
106045
|
106046
|
106047
|
106048
|
106049
|
106195
| 106255 |
107127
|
107225