mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-30 03:24:47 +00:00
We should map fields regardless of whether there are defaults set for anything.
They might all be mapped!
This commit is contained in:
parent
3105b0a62d
commit
f0c609f169
@ -263,20 +263,20 @@ function sync_user_from_LDAP( Principal &$principal, $mapping, $ldap_values ) {
|
|||||||
|
|
||||||
$fields_to_set = array();
|
$fields_to_set = array();
|
||||||
$updateable_fields = Principal::updateableFields();
|
$updateable_fields = Principal::updateableFields();
|
||||||
if ( isset($c->authenticate_hook['config']['default_value']) && is_array($c->authenticate_hook['config']['default_value']) ) {
|
foreach( $updateable_fields AS $field ) {
|
||||||
foreach( $updateable_fields AS $field ) {
|
if ( isset($mapping['active']) && !isset($mapping['user_active']) ) $field = 'active'; // Backward compatibility: now 'user_active'
|
||||||
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'
|
||||||
else if ( isset($mapping['updated']) && !isset($mapping['modified']) ) $field = 'updated'; // Backward compatibility: now 'modified'
|
if ( isset($mapping[$field]) && isset($ldap_values[$mapping[$field]]) ) {
|
||||||
if ( isset($mapping[$field]) && isset($ldap_values[$mapping[$field]]) ) {
|
$fields_to_set[$field] = $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] );
|
||||||
dbg_error_log( "LDAP", "Setting usr->%s to %s from LDAP field %s", $field, $ldap_values[$mapping[$field]], $mapping[$field] );
|
}
|
||||||
}
|
else if ( isset($c->authenticate_hook['config']['default_value']) && is_array($c->authenticate_hook['config']['default_value'])
|
||||||
else if ( isset($c->authenticate_hook['config']['default_value'][$field] ) ) {
|
&& isset($c->authenticate_hook['config']['default_value'][$field] ) ) {
|
||||||
$fields_to_set[$field] = $c->authenticate_hook['config']['default_value'][$field];
|
$fields_to_set[$field] = $c->authenticate_hook['config']['default_value'][$field];
|
||||||
dbg_error_log( "LDAP", "Setting usr->%s to %s from configured defaults", $field, $c->authenticate_hook['config']['default_value'][$field] );
|
dbg_error_log( "LDAP", "Setting usr->%s to %s from configured defaults", $field, $c->authenticate_hook['config']['default_value'][$field] );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $principal->Exists() ) {
|
if ( $principal->Exists() ) {
|
||||||
$principal->Update($fields_to_set);
|
$principal->Update($fields_to_set);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user