Bugzilla – Attachment 21279 Details for
Bug 9299
for loop in Auth_with_ldap.pm requires an extended patron attribute to be set or LDAP logins fail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9299: rework unique attributes check on ldap login
0001-Bug-9299-rework-unique-attributes-check-on-ldap-logi.patch (text/plain), 3.08 KB, created by
Jonathan Druart
on 2013-09-20 15:07:45 UTC
(
hide
)
Description:
Bug 9299: rework unique attributes check on ldap login
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-09-20 15:07:45 UTC
Size:
3.08 KB
patch
obsolete
>From 73e89ab1bf24e8b43560ac0218ac0144d81985df Mon Sep 17 00:00:00 2001 >From: Srdjan <srdjan@catalyst.net.nz> >Date: Wed, 5 Jun 2013 16:34:29 +1200 >Subject: [PATCH 1/1] Bug 9299: rework unique attributes check on ldap login >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >To reproduce: >- configure a ldap server and $KOHA_CONF, etc. >- try to log in >- you will got a software error: >Can't use an undefined value as an ARRAY reference at >/home/koha/src/C4/Auth_with_ldap.pm line 183. > >Signed-off-by: Nuño López Ansótegui <nunyo@masmedios.com> >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > C4/Auth_with_ldap.pm | 38 +++++++++++++++++--------------------- > 1 file changed, 17 insertions(+), 21 deletions(-) > >diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm >index 6143c9f..d7a5e9a 100644 >--- a/C4/Auth_with_ldap.pm >+++ b/C4/Auth_with_ldap.pm >@@ -170,29 +170,25 @@ sub checkpw_ldap { > } else { > return 0; # B2, D2 > } >- if (C4::Context->preference('ExtendedPatronAttributes') && $borrowernumber && ($config{update} ||$config{replicate})) { >- my $extended_patron_attributes; >+ if (C4::Context->preference('ExtendedPatronAttributes') && $borrowernumber && ($config{update} ||$config{replicate})) { >+ my @extended_patron_attributes; > foreach my $attribute_type ( C4::Members::AttributeTypes::GetAttributeTypes() ) { >- my $code = $attribute_type->{code}; >- if ( exists($borrower{$code}) && $borrower{$code} !~ m/^\s*$/ ) { # skip empty values >- push @$extended_patron_attributes, { code => $code, value => $borrower{$code} }; >- } >+ my $code = $attribute_type->{code}; >+ if ( exists($borrower{$code}) && $borrower{$code} !~ m/^\s*$/ ) { # skip empty values >+ push @extended_patron_attributes, { code => $code, value => $borrower{$code} }; >+ } > } >- my @errors; >- #Check before add >- for (my $i; $i< scalar(@$extended_patron_attributes)-1;$i++) { >- my $attr=$extended_patron_attributes->[$i]; >- unless (C4::Members::Attributes::CheckUniqueness($attr->{code}, $attr->{value}, $borrowernumber)) { >- unshift @errors, $i; >- warn "ERROR_extended_unique_id_failed $attr->{code} $attr->{value}"; >- } >- } >- #Removing erroneous attributes >- foreach my $index (@errors){ >- @$extended_patron_attributes=splice(@$extended_patron_attributes,$index,1); >- } >- C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes); >- } >+ #Check before add >+ my @unique_attr; >+ foreach my $attr ( @extended_patron_attributes ) { >+ if (C4::Members::Attributes::CheckUniqueness($attr->{code}, $attr->{value}, $borrowernumber)) { >+ push @unique_attr, $attr; >+ } else { >+ warn "ERROR_extended_unique_id_failed $attr->{code} $attr->{value}"; >+ } >+ } >+ C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, \@unique_attr); >+ } > return(1, $cardnumber, $userid); > } > >-- >1.7.10.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 9299
:
18652
|
19861
| 21279