diff --git a/application/Espo/Core/Acl.php b/application/Espo/Core/Acl.php index 4afc5c9b89..bb9031e1f2 100644 --- a/application/Espo/Core/Acl.php +++ b/application/Espo/Core/Acl.php @@ -45,7 +45,6 @@ use stdClass; class Acl { protected AclManager $aclManager; - protected User $user; public function __construct(AclManager $aclManager, User $user) @@ -64,6 +63,8 @@ class Acl /** * Get an access level for a specific scope and action. + * + * @param Table::ACTION_* $action */ public function getLevel(string $scope, string $action): string { @@ -216,7 +217,8 @@ class Acl /** * Get attributes forbidden for a user. * - * @param string $thresholdLevel Should not be used. Stands for possible future enhancements. * + * @param Table::ACTION_READ|Table::ACTION_EDIT $action An action. + * @param string $thresholdLevel Should not be used. Stands for possible future enhancements. * @return string[] */ public function getScopeForbiddenAttributeList( @@ -232,6 +234,7 @@ class Acl /** * Get fields forbidden for a user. * + * @param Table::ACTION_READ|Table::ACTION_EDIT $action An action. * @param string $thresholdLevel Should not be used. Stands for possible future enhancements. * @return string[] */ @@ -248,6 +251,7 @@ class Acl /** * Get links forbidden for a user. * + * @param Table::ACTION_READ|Table::ACTION_EDIT $action An action. * @param string $thresholdLevel Should not be used. Stands for possible future enhancements. * @return string[] */ @@ -261,7 +265,7 @@ class Acl } /** - * Whether a user has an access to another user over a specific permission. + * Whether a user has access to another user over a specific permission. * * @param User|string $target User entity or user ID. */ diff --git a/application/Espo/Core/Acl/ScopeData.php b/application/Espo/Core/Acl/ScopeData.php index c7fd130439..7fd462dc74 100644 --- a/application/Espo/Core/Acl/ScopeData.php +++ b/application/Espo/Core/Acl/ScopeData.php @@ -38,16 +38,10 @@ use RuntimeException; */ class ScopeData { - /** - * @var stdClass|bool - */ + /** @var stdClass|bool */ private $raw; - - /** - * @var array - */ + /** @var array */ private $actionData = []; - private bool $isBoolean = false; private function __construct() {} diff --git a/application/Espo/Core/Acl/Table.php b/application/Espo/Core/Acl/Table.php index 293d1c2ce5..6e2a250036 100644 --- a/application/Espo/Core/Acl/Table.php +++ b/application/Espo/Core/Acl/Table.php @@ -35,23 +35,15 @@ namespace Espo\Core\Acl; interface Table { public const LEVEL_YES = 'yes'; - public const LEVEL_NO = 'no'; - public const LEVEL_ALL = 'all'; - public const LEVEL_TEAM = 'team'; - public const LEVEL_OWN = 'own'; public const ACTION_READ = 'read'; - public const ACTION_STREAM = 'stream'; - public const ACTION_EDIT = 'edit'; - public const ACTION_DELETE = 'delete'; - public const ACTION_CREATE = 'create'; /** @@ -66,6 +58,8 @@ interface Table /** * Get a permission level. + * + * @return self::ACTION_* */ public function getPermissionLevel(string $permission): string; } diff --git a/application/Espo/Core/AclManager.php b/application/Espo/Core/AclManager.php index f0d572efdf..40f999d7d2 100644 --- a/application/Espo/Core/AclManager.php +++ b/application/Espo/Core/AclManager.php @@ -70,36 +70,21 @@ use InvalidArgumentException; */ class AclManager { - /** - * @var array - */ - private $accessCheckerHashMap = []; - - /** - * @var array - */ - private $ownershipCheckerHashMap = []; - - /** - * @var array - */ - protected $tableHashMap = []; - - /** - * @var array - */ - protected $mapHashMap = []; - - /** - * @var class-string - */ - protected $userAclClassName = Acl::class; - protected const PERMISSION_ASSIGNMENT = 'assignment'; - /** - * @var array> - */ + /** @var array */ + private $accessCheckerHashMap = []; + /** @var array */ + private $ownershipCheckerHashMap = []; + /** @var array */ + protected $tableHashMap = []; + /** @var array */ + protected $mapHashMap = []; + + /** @var class-string */ + protected $userAclClassName = Acl::class; + + /** @var array> */ private $entityActionInterfaceMap = [ Table::ACTION_CREATE => AccessEntityCreateChecker::class, Table::ACTION_READ => AccessEntityReadChecker::class, @@ -107,10 +92,7 @@ class AclManager Table::ACTION_DELETE => AccessEntityDeleteChecker::class, Table::ACTION_STREAM => AccessEntityStreamChecker::class, ]; - - /** - * @var array> - */ + /** @var array> */ private $actionInterfaceMap = [ Table::ACTION_CREATE => AccessCreateChecker::class, Table::ACTION_READ => AccessReadChecker::class, @@ -119,39 +101,19 @@ class AclManager Table::ACTION_STREAM => AccessStreamChecker::class, ]; - /** - * @var AccessCheckerFactory|\Espo\Core\Portal\Acl\AccessChecker\AccessCheckerFactory - */ + /** @var AccessCheckerFactory|\Espo\Core\Portal\Acl\AccessChecker\AccessCheckerFactory */ protected $accessCheckerFactory; - - /** - * @var OwnershipCheckerFactory|\Espo\Core\Portal\Acl\OwnershipChecker\OwnershipCheckerFactory - */ + /** @var OwnershipCheckerFactory|\Espo\Core\Portal\Acl\OwnershipChecker\OwnershipCheckerFactory */ protected $ownershipCheckerFactory; - - /** - * @var TableFactory - */ + /** @var TableFactory */ private $tableFactory; - - /** - * @var MapFactory - */ + /** @var MapFactory */ private $mapFactory; - - /** - * @var GlobalRestriction - */ + /** @var GlobalRestriction */ protected $globalRestriction; - - /** - * @var OwnerUserFieldProvider - */ + /** @var OwnerUserFieldProvider */ protected $ownerUserFieldProvider; - - /** - * @var EntityManager - */ + /** @var EntityManager */ protected $entityManager; public function __construct( @@ -228,6 +190,8 @@ class AclManager /** * Get an access level for a specific scope and action. + * + * @param Table::ACTION_* $action */ public function getLevel(User $user, string $scope, string $action): string { @@ -517,6 +481,7 @@ class AclManager /** * Get attributes forbidden for a user. * + * @param Table::ACTION_READ|Table::ACTION_EDIT $action An action. * @param string $thresholdLevel Should not be used. Stands for possible future enhancements. * @return string[] */ @@ -545,6 +510,7 @@ class AclManager /** * Get fields forbidden for a user. * + * @param Table::ACTION_READ|Table::ACTION_EDIT $action An action. * @param string $thresholdLevel Should not be used. Stands for possible future enhancements. * @return string[] */ @@ -573,6 +539,7 @@ class AclManager /** * Get links forbidden for a user. * + * @param Table::ACTION_READ|Table::ACTION_EDIT $action An action. * @param string $thresholdLevel Should not be used. Stands for possible future enhancements. * @return string[] */ @@ -590,7 +557,7 @@ class AclManager } /** - * Whether a user has an access to another user over a specific permission. + * Whether a user has access to another user over a specific permission. * * @param User|string $target User entity or user ID. */