diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 4cfc077f0be..15047b2f2d7 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -331,10 +331,17 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu // is linked to a company allowed to $user. if (! empty($objectid) && $objectid > 0) { - $ok = checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select); - return $ok ? 1 : accessforbidden(); + if (!checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select)) + accessforbidden(); } + // get more permissions checks from hooks + global $hookmanager; + $hookmanager->initHooks(array('permissions')); + $parameters=array('features'=>$features,'objectid'=>preg_replace("/'/", '', $objectid),'idtype'=>$dbt_select); + $reshook=$hookmanager->executeHooks('restricted',$parameters); + if ($reshook < 0) accessforbidden(); + return 1; }