#10254 added secondary server in ad

This commit is contained in:
Daniel Cebrian 2023-06-13 12:37:28 +02:00
parent 6a941f6cda
commit 8678df6982
3 changed files with 46 additions and 2 deletions

View File

@ -538,7 +538,13 @@ echo '</form>';
if ($('input[type=checkbox][name=secondary_ldap_enabled]:checked').val() == 1) {
$("tr[id*='ldap_'][id$='_secondary']").show();
} else {
$( "tr[id*='ldap_'][id$='_secondary']" ).hide();
$( "tr[id*='ldap_'][id$='_secondary']" ).hide();
}
if ($('input[type=checkbox][name=secondary_active_directory]:checked').val() == 1) {
$("tr[id*='ad_'][id$='_secondary']").show();
} else {
$( "tr[id*='ad_'][id$='_secondary']" ).hide();
}
}
$( document ).ready(function() {

View File

@ -237,7 +237,13 @@ function process_user_login_remote($login, $pass, $api=false)
// Active Directory.
case 'ad':
if (enterprise_hook('ad_process_user_login', [$login, $pass]) === false) {
$sr = enterprise_hook('ad_process_user_login', [$login, $pass]);
// Try with secondary server.
if ($sr === false && (bool) $config['secondary_active_directory'] === true) {
$sr = enterprise_hook('ad_process_user_login', [$login, $pass, true]);
}
if ($sr === false) {
$config['auth_error'] = 'User not found in database or incorrect password';
return false;
}

View File

@ -623,6 +623,38 @@ function config_update_config()
$error_update[] = __('Domain');
}
if (config_update_value('secondary_active_directory', get_parameter('secondary_active_directory'), true) === false) {
$error_update[] = __('Secondary active directory');
}
if (config_update_value('ad_server_secondary', get_parameter('ad_server_secondary'), true) === false) {
$error_update[] = __('Secondary active directory server');
}
if (config_update_value('ad_port_secondary', get_parameter('ad_port_secondary'), true) === false) {
$error_update[] = __('Secondary active directory port');
}
if (config_update_value('ad_start_tls_secondary', get_parameter('ad_start_tls_secondary'), true) === false) {
$error_update[] = __('Secondary start TLS');
}
if (config_update_value('recursive_search_secondary', get_parameter('recursive_search_secondary'), true) === false) {
$error_update[] = __('Secondary recursive search');
}
if (config_update_value('ad_advanced_config_secondary', get_parameter('ad_advanced_config_secondary'), true) === false) {
$error_update[] = __('Secondary advanced Config AD');
}
if (config_update_value('ldap_advanced_config_secondary', get_parameter('ldap_advanced_config_secondary'), true) === false) {
$error_update[] = __('Secondary advanced Config LDAP');
}
if (config_update_value('ad_domain_secondary', get_parameter('ad_domain_secondary'), true) === false) {
$error_update[] = __('Secondary domain');
}
if (config_update_value('ad_adv_perms', get_parameter('ad_adv_perms'), true) === false) {
$error_update[] = __('Advanced Permisions AD');
}