diff --git a/application/Espo/Core/Acl.php b/application/Espo/Core/Acl.php index 1b9dc798d7..aa8ac240e3 100644 --- a/application/Espo/Core/Acl.php +++ b/application/Espo/Core/Acl.php @@ -188,6 +188,8 @@ class Acl /** * Get attributes forbidden for a user. + * + * @return array */ public function getScopeForbiddenAttributeList( string $scope, @@ -201,6 +203,8 @@ class Acl /** * Get fields forbidden for a user. + * + * @return array */ public function getScopeForbiddenFieldList( string $scope, @@ -214,6 +218,8 @@ class Acl /** * Get links forbidden for a user. + * + * @return array */ public function getScopeForbiddenLinkList( string $scope, diff --git a/application/Espo/Core/AclManager.php b/application/Espo/Core/AclManager.php index af1d9d06e7..7adb5e4ecb 100644 --- a/application/Espo/Core/AclManager.php +++ b/application/Espo/Core/AclManager.php @@ -36,11 +36,12 @@ use Espo\Entities\User; use Espo\Core\{ ORM\EntityManager, Acl\AclFactory, - Acl\ScopeAcl, Acl\GlobalRestrictonFactory, Acl\GlobalRestricton, Acl as UserAclWrapper, Acl\Table as Table, + Acl\ScopeAcl, + Acl\EntityAcl, Acl\EntityCreateAcl, Acl\EntityReadAcl, Acl\EntityEditAcl, @@ -49,6 +50,7 @@ use Espo\Core\{ }; use StdClass; +use RuntimeException; /** * Used to check access for a specific user. @@ -229,6 +231,10 @@ class AclManager return $impl->$methodName($user, $entity, $data); } + if (!$impl instanceof EntityAcl) { + throw new RuntimeException("Acl must implement EntityAcl interface."); + } + if (method_exists($impl, $methodName)) { // For backward compatibility. return $impl->$methodName($user, $entity, $data); @@ -374,6 +380,8 @@ class AclManager /** * Get attributes forbidden for a user. + * + * @return array */ public function getScopeForbiddenAttributeList( User $user, @@ -405,6 +413,8 @@ class AclManager /** * Get fields forbidden for a user. + * + * @return array */ public function getScopeForbiddenFieldList( User $user, @@ -436,6 +446,8 @@ class AclManager /** * Get links forbidden for a user. + * + * @return array */ public function getScopeForbiddenLinkList( User $user,