diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5a9ce90af0d..4bfec85ead1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8457,8 +8457,9 @@ abstract class CommonObject $element = 'facture'; } elseif ($element == 'invoice_supplier_rec') { return $user->rights->fournisseur->facture; - } elseif ($element == 'evaluation') { - return $user->rights->hrm->evaluation; + } elseif (!empty($user->rights->{$this->module}->{$element})) { + // for modules built with ModuleBuilder + return $user->rights->{$this->module}->{$element}; } return $user->rights->{$element}; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 52e7a975338..2d5b06fe999 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -353,6 +353,9 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', } else { $objectid = $object; // $objectid can be X or 'X,Y,Z' } + if ($objectid == "-1") { + $objectid = 0; + } if ($objectid) { $objectid = preg_replace('/[^0-9\.\,]/', '', $objectid); // For the case value is coming from a non sanitized user input }