From 3105b0a62d110bf4960368058675739cde1174ef Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Tue, 18 Oct 2011 10:42:58 +1300 Subject: [PATCH] Fix handling of superseded defaults in LDAP field mapping. --- inc/drivers_ldap.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/drivers_ldap.php b/inc/drivers_ldap.php index d9e1f14d..c6e21613 100644 --- a/inc/drivers_ldap.php +++ b/inc/drivers_ldap.php @@ -263,11 +263,11 @@ function sync_user_from_LDAP( Principal &$principal, $mapping, $ldap_values ) { $fields_to_set = array(); $updateable_fields = Principal::updateableFields(); - $updateable_fields[] = 'active'; // Backward compatibility: now 'user_exists' - $updateable_fields[] = 'updated'; // Backward compatibility: now 'modified' if ( isset($c->authenticate_hook['config']['default_value']) && is_array($c->authenticate_hook['config']['default_value']) ) { foreach( $updateable_fields AS $field ) { - if ( isset($ldap_values[$mapping[$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] ); } -- 2.11.4.GIT