Bugzilla – Attachment 57619 Details for
Bug 17615
LDAP Auth: regression causes attribute updates to silently fail and corrupt existing data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 17615 - Fix updating borrower attributes in checkpw_ldap
PASSED-QA-Bug-17615---Fix-updating-borrower-attrib.patch (text/plain), 3.18 KB, created by
Martin Renvoize (ashimema)
on 2016-11-18 08:53:41 UTC
(
hide
)
Description:
[PASSED QA] Bug 17615 - Fix updating borrower attributes in checkpw_ldap
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2016-11-18 08:53:41 UTC
Size:
3.18 KB
patch
obsolete
>From 23d2e51061585fba457c4825b9b0d27f7b72f5ce Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Wed, 16 Nov 2016 10:37:48 +0000 >Subject: [PATCH] [PASSED QA] Bug 17615 - Fix updating borrower attributes in > checkpw_ldap > >Signed-off-by: Oliver Bock <oliver.bock@aei.mpg.de> > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Auth_with_ldap.pm | 2 +- > t/db_dependent/Auth_with_ldap.t | 30 +++++++++++++++++++++++++----- > 2 files changed, 26 insertions(+), 6 deletions(-) > >diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm >index 03e81e1..a58f4e6 100644 >--- a/C4/Auth_with_ldap.pm >+++ b/C4/Auth_with_ldap.pm >@@ -222,7 +222,7 @@ sub checkpw_ldap { > next; > } > if (C4::Members::Attributes::CheckUniqueness($code, $borrower{$code}, $borrowernumber)) { >- C4::Members::Attributes::UpdateBorrowerAttribute($borrowernumber, {code => $code, value => $borrower{$code}}); >+ C4::Members::Attributes::UpdateBorrowerAttribute($borrowernumber, {code => $code, attribute => $borrower{$code}}); > } else { > warn "ERROR_extended_unique_id_failed $code $borrower{$code}"; > } >diff --git a/t/db_dependent/Auth_with_ldap.t b/t/db_dependent/Auth_with_ldap.t >index 6e20c69..f962628 100755 >--- a/t/db_dependent/Auth_with_ldap.t >+++ b/t/db_dependent/Auth_with_ldap.t >@@ -27,11 +27,12 @@ use C4::Context; > > use Koha::Patrons; > >-my $dbh = C4::Context->dbh; >+my $dbh = ''; > > # Start transaction >-$dbh->{AutoCommit} = 0; >-$dbh->{RaiseError} = 1; >+my $database = Koha::Database->new(); >+my $schema = $database->schema(); >+$schema->storage->txn_begin(); > > my $builder = t::lib::TestBuilder->new(); > >@@ -83,6 +84,14 @@ my $attr_type = $builder->build( > } > } > ); >+my $attr_type2 = $builder->build( >+ { >+ source => 'BorrowerAttributeType', >+ value => { >+ category_code => $categorycode >+ } >+ } >+); > > my $borrower = $builder->build( > { >@@ -133,7 +142,7 @@ subtest 'checkpw_ldap tests' => sub { > > subtest 'auth_by_bind = 1 tests' => sub { > >- plan tests => 8; >+ plan tests => 9; > > $auth_by_bind = 1; > >@@ -167,6 +176,14 @@ subtest 'checkpw_ldap tests' => sub { > return $borrower->{cardnumber}; > } > ); >+ $auth->mock( >+ 'ldap_entry_2_hash', >+ sub { >+ return ( >+ $attr_type2->{code}, 'BAR' >+ ); >+ } >+ ); > > C4::Auth_with_ldap::checkpw_ldap( $dbh, 'hola', password => 'hey' ); > ok( >@@ -177,7 +194,10 @@ subtest 'checkpw_ldap tests' => sub { > }, > 'Extended attributes are not deleted' > ); >+ >+ is( C4::Members::Attributes::GetBorrowerAttributeValue($borrower->{borrowernumber}, $attr_type2->{code}), 'BAR', 'Mapped attribute is BAR' ); > $auth->unmock('update_local'); >+ $auth->unmock('ldap_entry_2_hash'); > > $update = 0; > $desired_count_result = 0; # user auth problem >@@ -508,6 +528,6 @@ sub reload_ldap_module { > return; > } > >-$dbh->rollback; >+$schema->storage->txn_rollback(); > > 1; >-- >2.1.4
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 17615
:
57532
|
57587
|
57593
|
57619
|
59220
|
59263
|
59264
|
59265
|
59266