Skip to content

Commit

Permalink
Fix: you can't check "fournisseur" with checkUserAccessToObject without
Browse files Browse the repository at this point in the history
object ID
  • Loading branch information
hregis committed Feb 12, 2018
1 parent 448fcae commit 24cc687
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion htdocs/core/lib/security.lib.php
Expand Up @@ -378,7 +378,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
if ($feature == 'task') $feature='projet_task';

$check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe','fournisseur'); // Test for societe object
$checksoc = array('societe'); // Test for societe object
$checkother = array('contact','agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet','project'); // Test for project object
$checktask = array('projet_task');
Expand Down
4 changes: 3 additions & 1 deletion htdocs/product/fournisseurs.php
Expand Up @@ -51,6 +51,8 @@
$backtopage=GETPOST('backtopage','alpha');
$error=0;

if (!$user->rights->fournisseur->lire) accessforbidden();

// If socid provided by ajax company selector
if (! empty($_REQUEST['search_fourn_id']))
{
Expand All @@ -63,7 +65,7 @@
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service&fournisseur',$fieldvalue,'product&product','','',$fieldtype);
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);

$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
Expand Down

0 comments on commit 24cc687

Please sign in to comment.