From 70015d7c83c80577830de2bd2af15f2549d652c7 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Tue, 18 Oct 2011 11:05:45 +1300 Subject: [PATCH] Working on fixing LDAP mappings. --- inc/drivers_ldap.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/inc/drivers_ldap.php b/inc/drivers_ldap.php index fadac299..6dfed30c 100644 --- a/inc/drivers_ldap.php +++ b/inc/drivers_ldap.php @@ -263,9 +263,17 @@ function sync_user_from_LDAP( Principal &$principal, $mapping, $ldap_values ) { $fields_to_set = array(); $updateable_fields = Principal::updateableFields(); + if ( isset($mapping['active']) && !isset($mapping['user_active']) ) { + // Backward compatibility: now 'user_active' + $mapping['user_active'] = $mapping['active']; + unset($mapping['active']); + } + if ( isset($mapping['updated']) && !isset($mapping['modified']) ) { + // Backward compatibility: now 'modified' + $mapping['modified'] = $mapping['updated']; + unset($mapping['updated']); + } foreach( $updateable_fields AS $field ) { - if ( isset($mapping['active']) && !isset($mapping['user_active']) ) $field = 'active'; // Backward compatibility: now 'user_active' - else if ( isset($mapping['updated']) && !isset($mapping['modified']) ) $field = 'updated'; // Backward compatibility: now 'modified' if ( isset($mapping[$field]) && isset($ldap_values[$mapping[$field]]) ) { $fields_to_set[$field] = $ldap_values[$mapping[$field]]; dbg_error_log( "LDAP", "Setting usr->%s to %s from LDAP field %s", $field, $ldap_values[$mapping[$field]], $mapping[$field] );