Fix: limit to company name for a server with multiple instance of dolibarr

This commit is contained in:
Regis Houssin 2009-09-15 16:05:58 +00:00
parent b301340102
commit ab93a4ef8c
3 changed files with 8 additions and 3 deletions

View File

@ -471,7 +471,9 @@ function listOfSessions()
{ {
$sessValues = file_get_contents($fullpath); // get raw session data $sessValues = file_get_contents($fullpath); // get raw session data
if (eregi('dol_login',$sessValues) && eregi('dol_entity\|s:([0-9]+):"('.$conf->entity.')"',$sessValues)) // limit to dolibarr session and current entity if (eregi('dol_login',$sessValues) && // limit to dolibarr session
eregi('dol_entity\|s:([0-9]+):"('.$conf->entity.')"',$sessValues) && // limit to current entity
eregi('dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"',$sessValues)) // limit to company name
{ {
$tmp=split('_', $file); $tmp=split('_', $file);
$idsess=$tmp[1]; $idsess=$tmp[1];
@ -513,7 +515,9 @@ function purgeSessions($mysessionid)
{ {
$sessValues = file_get_contents($fullpath); // get raw session data $sessValues = file_get_contents($fullpath); // get raw session data
if (eregi('dol_login',$sessValues) && eregi('dol_entity\|s:([0-9]+):"('.$conf->entity.')"',$sessValues)) // limit to dolibarr session and current entity if (eregi('dol_login',$sessValues) && // limit to dolibarr session
eregi('dol_entity\|s:([0-9]+):"('.$conf->entity.')"',$sessValues) && // limit to current entity
eregi('dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"',$sessValues)) // limit to company name
{ {
$tmp=split('_', $file); $tmp=split('_', $file);
$idsess=$tmp[1]; $idsess=$tmp[1];

View File

@ -441,6 +441,7 @@ if (! isset($_SESSION["dol_login"]))
// New session for this login // New session for this login
$_SESSION["dol_login"]=$user->login; $_SESSION["dol_login"]=$user->login;
$_SESSION["dol_authmode"]=$conf->authmode; $_SESSION["dol_authmode"]=$conf->authmode;
$_SESSION["dol_company"]=$conf->global->MAIN_INFO_SOCIETE_NOM;
if ($conf->multicompany->enabled) $_SESSION["dol_entity"]=$conf->entity; if ($conf->multicompany->enabled) $_SESSION["dol_entity"]=$conf->entity;
dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id()); dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id());

View File

@ -348,7 +348,7 @@ if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC'))
$mysoc->siret=empty($conf->global->MAIN_INFO_SIRET)?'':$conf->global->MAIN_INFO_SIRET; $mysoc->siret=empty($conf->global->MAIN_INFO_SIRET)?'':$conf->global->MAIN_INFO_SIRET;
$mysoc->ape=empty($conf->global->MAIN_INFO_APE)?'':$conf->global->MAIN_INFO_APE; $mysoc->ape=empty($conf->global->MAIN_INFO_APE)?'':$conf->global->MAIN_INFO_APE;
$mysoc->rcs=empty($conf->global->MAIN_INFO_RCS)?'':$conf->global->MAIN_INFO_RCS; $mysoc->rcs=empty($conf->global->MAIN_INFO_RCS)?'':$conf->global->MAIN_INFO_RCS;
// Id prof g<EFBFBD>n<EFBFBD>riques // Id prof generiques
$mysoc->profid1=empty($conf->global->MAIN_INFO_SIREN)?'':$conf->global->MAIN_INFO_SIREN; $mysoc->profid1=empty($conf->global->MAIN_INFO_SIREN)?'':$conf->global->MAIN_INFO_SIREN;
$mysoc->profid2=empty($conf->global->MAIN_INFO_SIRET)?'':$conf->global->MAIN_INFO_SIRET; $mysoc->profid2=empty($conf->global->MAIN_INFO_SIRET)?'':$conf->global->MAIN_INFO_SIRET;
$mysoc->profid3=empty($conf->global->MAIN_INFO_APE)?'':$conf->global->MAIN_INFO_APE; $mysoc->profid3=empty($conf->global->MAIN_INFO_APE)?'':$conf->global->MAIN_INFO_APE;