Let me quickly explain our situation: we want to get data from ldap for
new users, but allow librarians to edit data in Koha, and preserve this
changes.

Logical solution would be to turn replication on, and update off in
/etc/koha/koha-conf.xml with something like this:

 <replicate>1</replicate>  <!-- add new users from LDAP to Koha database -->
 <update>0</update>        <!-- update existing users in Koha database -->

but that doesn't work. I tracked problem to || 1 in Auth_with_ldap.pm
which always turn both options on no matter what user specifies in xml
file. Attached patch fixes this problem.


We also needed to augment data available in LDAP with data from CSV
files generated by other systems, so I wrote ldap rewriter documented in
following blog post:

http://blog.rot13.org/2009/03/virtual_ldap_rewrite_or_augment_data_on_the_fly.html

It's somewhat specific for our needs, but I hope that it will also be
useful to other as food for thought if nothing else.

-- 
Dobrica Pavlinusic               2share!2flame            dpav...@rot13.org
Unix addict. Internet consultant.             http://www.rot13.org/~dpavlin
commit 718390768ad448e4d025849570bcdf97151351dc
Author: Dobrica Pavlinusic <dpav...@rot13.org>
Date:   Mon Mar 16 07:14:12 2009 +0100

    BUG FIX: update and replace must be by default 0, because otherwise
    we can't just replicate without update

diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm
index 3f965a7..84ad0f6 100644
--- a/C4/Auth_with_ldap.pm
+++ b/C4/Auth_with_ldap.pm
@@ -62,8 +62,8 @@ $debug and print STDERR "Got ", scalar(@mapkeys), " ldap mapkeys (populated): ",
 
 my %config = (
 	anonymous => ($ldapname and $ldappassword) ? 0 : 1,
-	replicate => $ldap->{replicate} || 1,		#    add from LDAP to Koha database for new user
-	   update => $ldap->{update}    || 1,		# update from LDAP to Koha database for existing user
+	replicate => $ldap->{replicate} || 0,		#    add from LDAP to Koha database for new user
+	   update => $ldap->{update}    || 0,		# update from LDAP to Koha database for existing user
 );
 
 sub description ($) {
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-devel

Reply via email to