Fix: Use entity

This commit is contained in:
Laurent Destailleur 2013-04-25 10:22:08 +02:00
parent 86ea79c860
commit 023b6f2e8b
4 changed files with 14 additions and 12 deletions

View File

@ -1233,13 +1233,15 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$
*
* @param string $modulepart Module of document
* @param string $original_file Relative path with filename
* @param string $entity Restrict onto entity
* @return mixed Array with access information : accessallowed & sqlprotectagainstexternals & original_file (as full path name)
*/
function dol_check_secure_access_document($modulepart,$original_file)
function dol_check_secure_access_document($modulepart,$original_file,$entity)
{
global $user, $conf;
if (empty($modulepart)) return 'ErrorBadParameter';
if (empty($entity)) $entity=0;
// We define $accessallowed and $sqlprotectagainstexternals
$accessallowed=0;

View File

@ -96,7 +96,7 @@ $refname=basename(dirname($original_file)."/");
// Security check
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
$check_access = dol_check_secure_access_document($modulepart,$original_file);
$check_access = dol_check_secure_access_document($modulepart,$original_file,$entity);
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file'];

View File

@ -100,7 +100,7 @@ $original_file = str_replace("../","/", $original_file);
// Security check
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
$check_access = dol_check_secure_access_document($modulepart,$original_file);
$check_access = dol_check_secure_access_document($modulepart,$original_file,$entity);
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file'];

View File

@ -221,10 +221,10 @@ function getDocument($authentication, $modulepart, $file)
$refname=basename(dirname($original_file)."/");
// Security check
$accessallowed=0;
$check_access = dol_check_secure_access_document($modulepart,$original_file);
$accessallowed=$check_access['accessallowed'];
$check_access = dol_check_secure_access_document($modulepart,$original_file,$conf->entity);
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file'];
// Basic protection (against external users only)
if ($fuser->societe_id > 0)