Fix several security holes on api when used by external users

This commit is contained in:
Laurent Destailleur
2016-12-07 19:02:39 +01:00
parent d23604701c
commit 1838670e31
13 changed files with 60 additions and 42 deletions

View File

@@ -101,10 +101,12 @@ class Orders extends DolibarrApi
global $db, $conf;
$obj_ret = array();
// case of external user, $thirdpartyid param is ignored and replaced by user's socid
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
$sql = "SELECT t.rowid";