Bugzilla – Attachment 25526 Details for
Bug 11807
Add categorycode conversions to LDAP authentication.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add support for categorycode conversions when updating an user using a LDAP server.
0001-Add-support-for-categorycode-conversions-when-updati.patch (text/plain), 2.52 KB, created by
Frédérick Capovilla
on 2014-02-20 21:15:44 UTC
(
hide
)
Description:
Add support for categorycode conversions when updating an user using a LDAP server.
Filename:
MIME Type:
Creator:
Frédérick Capovilla
Created:
2014-02-20 21:15:44 UTC
Size:
2.52 KB
patch
obsolete
>From c3a5408ddffc4aae03af24bdd2e60da81167d94d Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick?= <frederick.capovilla@libeo.com> >Date: Wed, 19 Feb 2014 12:02:41 -0500 >Subject: [PATCH] Add support for categorycode conversions when updating an user using > a LDAP server. > >--- > C4/Auth_with_ldap.pm | 22 ++++++++++++++++++++++ > 1 files changed, 22 insertions(+), 0 deletions(-) > >diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm >index 3b40015..af946fc 100644 >--- a/C4/Auth_with_ldap.pm >+++ b/C4/Auth_with_ldap.pm >@@ -26,6 +26,7 @@ use C4::Context; > use C4::Members qw(AddMember changepassword); > use C4::Members::Attributes; > use C4::Members::AttributeTypes; >+use C4::Dates; > use C4::Auth qw(checkpw_internal); > use Koha::AuthUtils qw(hash_password); > use List::MoreUtils qw( any ); >@@ -65,6 +66,15 @@ $debug and print STDERR "Got ", scalar(@mapkeys), " ldap mapkeys ( total ): ", > @mapkeys = grep {defined $mapping{$_}->{is}} @mapkeys; > $debug and print STDERR "Got ", scalar(@mapkeys), " ldap mapkeys (populated): ", join ' ', @mapkeys, "\n"; > >+my %categorycode_conversions; >+my $default_categorycode; >+if(defined $ldap->{categorycode_mapping}) { >+ $default_categorycode = $ldap->{categorycode_mapping}->{default}; >+ foreach my $cat (@{$ldap->{categorycode_mapping}->{categorycode}}) { >+ $categorycode_conversions{$cat->{value}} = $cat->{content}; >+ } >+} >+ > my %config = ( > anonymous => ($ldapname and $ldappassword) ? 0 : 1, > replicate => defined($ldap->{replicate}) ? $ldap->{replicate} : 1, # add from LDAP to Koha database for new user >@@ -248,6 +258,18 @@ sub ldap_entry_2_hash { > . substr($borrower{ 'surname' },0,1) > . " "); > >+ # Date and categorycode conversions >+ $borrower{'dateexpiry'} = C4::Dates->new($borrower{'dateexpiry'},'sql')->output('iso') if $borrower{'dateexpiry'}; >+ $borrower{'dateofbirth'} = C4::Dates->new($borrower{'dateofbirth'},'sql')->output('iso') if $borrower{'dateofbirth'}; >+ $borrower{'dateenrolled'} = C4::Dates->new($borrower{'dateenrolled'},'sql')->output('iso') if $borrower{'dateenrolled'}; >+ >+ if(defined $categorycode_conversions{$borrower{categorycode}}) { >+ $borrower{categorycode} = $categorycode_conversions{$borrower{categorycode}}; >+ } >+ elsif($default_categorycode) { >+ $borrower{categorycode} = $default_categorycode; >+ } >+ > # check if categorycode exists, if not, fallback to default from koha-conf.xml > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare("SELECT categorycode FROM categories WHERE categorycode = ?"); >-- >1.7.2.5 >
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 11807
:
25526
|
42105
|
46182
|
46183
|
49789
|
49790