Bugzilla – Attachment 95965 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: Move get_hash to Koha::Anonymized
Bug-24151-Move-gethash-to-KohaAnonymized.patch (text/plain), 3.65 KB, created by
Jonathan Druart
on 2019-12-03 18:11:27 UTC
(
hide
)
Description:
Bug 24151: Move get_hash to Koha::Anonymized
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-12-03 18:11:27 UTC
Size:
3.65 KB
patch
obsolete
>From 5ce074b72bada9b9100753147b3f983bb5b66555 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 26 Nov 2019 20:21:21 +0100 >Subject: [PATCH] Bug 24151: Move get_hash to Koha::Anonymized > >To avoid duplicated code. > >Sponsored-by: Association KohaLa - https://koha-fr.org/ >--- > Koha/Anonymized.pm | 35 +++++++++++++++++++++++++++++++++++ > Koha/Anonymized/Patron.pm | 10 ++-------- > Koha/Anonymized/Transaction.pm | 9 +-------- > 3 files changed, 38 insertions(+), 16 deletions(-) > create mode 100644 Koha/Anonymized.pm > >diff --git a/Koha/Anonymized.pm b/Koha/Anonymized.pm >new file mode 100644 >index 0000000000..fbf5ab2182 >--- /dev/null >+++ b/Koha/Anonymized.pm >@@ -0,0 +1,35 @@ >+package Koha::Anonymized; >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use Carp; >+use Crypt::Eksblowfish::Bcrypt qw(bcrypt); >+ >+use Koha::Exceptions::Config; >+ >+sub get_hash { >+ my ( $class, $s ) = @_; >+ my $key = C4::Context->config('key'); >+ >+ Koha::Exceptions::Config::MissingEntry->throw( >+ "Missing 'key' entry in config file") unless $key; >+ >+ return bcrypt($s, $key); >+} >+ >+1; >diff --git a/Koha/Anonymized/Patron.pm b/Koha/Anonymized/Patron.pm >index 1cd5ba9c2c..0d2fc38c19 100644 >--- a/Koha/Anonymized/Patron.pm >+++ b/Koha/Anonymized/Patron.pm >@@ -18,9 +18,9 @@ package Koha::Anonymized::Patron; > use Modern::Perl; > > use Carp; >-use Crypt::Eksblowfish::Bcrypt qw(bcrypt en_base64); > > use Koha::Database; >+use Koha::Anonymized; > > use base qw(Koha::Object); > >@@ -36,17 +36,11 @@ Koha::Anonymized::Patron - Koha Anonymized::Patron Object class > > =cut > >-sub get_hash { >- my ( $class, $borrowernumber) = @_; >- return bcrypt($borrowernumber, C4::Context->config('key')); >-} >- >- > sub new_from_patron { > my ( $class, $patron ) = @_; > > my $self = $class->SUPER::new({ >- hashed_borrowernumber => $class->get_hash($patron->borrowernumber), >+ hashed_borrowernumber => Koha::Anonymized->get_hash($patron->borrowernumber), > }); > > $self->update_from_patron($patron); >diff --git a/Koha/Anonymized/Transaction.pm b/Koha/Anonymized/Transaction.pm >index e536674629..e57712c936 100644 >--- a/Koha/Anonymized/Transaction.pm >+++ b/Koha/Anonymized/Transaction.pm >@@ -18,7 +18,6 @@ package Koha::Anonymized::Transaction; > use Modern::Perl; > > use Carp; >-use Crypt::Eksblowfish::Bcrypt qw(bcrypt en_base64); > > use Koha::Database; > >@@ -36,17 +35,11 @@ Koha::Anonymized::Transaction - Koha Anonymized::Transaction Object class > > =cut > >-sub get_hash { >- my ( $class, $borrowernumber) = @_; >- return bcrypt($borrowernumber, C4::Context->config('key')); >-} >- >- > sub new_from_statistic { > my ( $class, $statistic ) = @_; > > my $values = { >- hashed_borrowernumber => $class->get_hash($statistic->borrowernumber), >+ hashed_borrowernumber => Koha::Anonymized->get_hash($statistic->borrowernumber), > }; > > my @fields_to_copy = split ',', C4::Context->preference('PseudonymizationTransactionFields') || ''; >-- >2.11.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 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