check if $mc is a valid global
This commit is contained in:
parent
3f5fe432e7
commit
043d11d785
@ -111,15 +111,22 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
|
|||||||
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
|
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($passok && ! empty($conf->multicompany->enabled)) // We must check entity
|
// We must check entity
|
||||||
|
if ($passok)
|
||||||
{
|
{
|
||||||
global $mc;
|
global $mc;
|
||||||
|
|
||||||
$ret=$mc->checkRight($obj->rowid, $entitytotest);
|
if (!isset($mc)) {
|
||||||
if ($ret < 0)
|
//Global not available, disable $conf->multicompany->enabled for safety
|
||||||
{
|
$conf->multicompany->enabled = false;
|
||||||
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko entity '".$entitytotest."' not allowed for user '".$obj->rowid."'");
|
}
|
||||||
$login=''; // force authentication failure
|
|
||||||
|
if (! empty($conf->multicompany->enabled)) {
|
||||||
|
$ret = $mc->checkRight($obj->rowid, $entitytotest);
|
||||||
|
if ($ret < 0) {
|
||||||
|
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko entity '" . $entitytotest . "' not allowed for user '" . $obj->rowid . "'");
|
||||||
|
$login = ''; // force authentication failure
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user