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,12 +233,14 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
$usertmp = new User($db); $usertmp = new User($db);
$usertmp->fetch('', $login); $usertmp->fetch('', $login);
$ret = $mc->checkRight($usertmp->id, $entitytotest); if (is_object($mc)) {
if ($ret < 0) { $ret = $mc->checkRight($usertmp->id, $entitytotest);
dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user id '".$usertmp->id."'", LOG_NOTICE); if ($ret < 0) {
$login = ''; // force authentication failure dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user id '".$usertmp->id."'", LOG_NOTICE);
$login = ''; // force authentication failure
}
unset($usertmp);
} }
unset($usertmp);
} }
} }
if ($result == 1) { if ($result == 1) {