Avoid fatal error when multicompany not correctly installed

This commit is contained in:
Laurent Destailleur 2022-09-16 00:50:02 +02:00
parent e0e9701830
commit 76e8d6d36d

View File

@ -233,6 +233,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
$usertmp = new User($db); $usertmp = new User($db);
$usertmp->fetch('', $login); $usertmp->fetch('', $login);
if (is_object($mc)) {
$ret = $mc->checkRight($usertmp->id, $entitytotest); $ret = $mc->checkRight($usertmp->id, $entitytotest);
if ($ret < 0) { if ($ret < 0) {
dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user id '".$usertmp->id."'", LOG_NOTICE); dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user id '".$usertmp->id."'", LOG_NOTICE);
@ -241,6 +242,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
unset($usertmp); unset($usertmp);
} }
} }
}
if ($result == 1) { if ($result == 1) {
dol_syslog("functions_ldap::check_user_password_ldap Authentication KO bad user/password for '".$usertotest."'", LOG_NOTICE); dol_syslog("functions_ldap::check_user_password_ldap Authentication KO bad user/password for '".$usertotest."'", LOG_NOTICE);
sleep(1); sleep(1);