Bugzilla – Attachment 18652 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
bug9299-rework-unique-attributes-check-on-ldap-log.patch (text/plain), 2.65 KB, created by
Srdjan Jankovic
on 2013-06-05 04:37:49 UTC
(
hide
)
Description:
bug_9299: rework unique attributes check on ldap login
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2013-06-05 04:37:49 UTC
Size:
2.65 KB
patch
obsolete
>From ed265bfcde615e012939ab747c67a75ed5d75180 Mon Sep 17 00:00:00 2001 >From: Srdjan <srdjan@catalyst.net.nz> >Date: Wed, 5 Jun 2013 16:34:29 +1200 >Subject: [PATCH] bug_9299: rework unique attributes check on ldap login > >--- > 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 1f2f617..6ee9769 100644 >--- a/C4/Auth_with_ldap.pm >+++ b/C4/Auth_with_ldap.pm >@@ -165,29 +165,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.8.1.2
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