implementationHashMap[$scope])) { $normalizedName = Util::normilizeClassName($scope); $className = '\\Espo\\Custom\\AclPortal\\' . $normalizedName; if (!class_exists($className)) { $moduleName = $this->getMetadata()->getScopeModuleName($scope); if ($moduleName) { $className = '\\Espo\\Modules\\' . $moduleName . '\\AclPortal\\' . $normalizedName; } else { $className = '\\Espo\\AclPortal\\' . $normalizedName; } if (!class_exists($className)) { $className = '\\Espo\\Core\\AclPortal\\Base'; } } if (class_exists($className)) { $acl = new $className($scope); $dependencies = $acl->getDependencyList(); foreach ($dependencies as $name) { $acl->inject($name, $this->getContainer()->get($name)); } $this->implementationHashMap[$scope] = $acl; } else { throw new Error(); } } return $this->implementationHashMap[$scope]; } protected function getTable(User $user) { $key = spl_object_hash($user); if (empty($this->tableHashMap[$key])) { $config = $this->getContainer()->get('config'); $fileManager = $this->getContainer()->get('fileManager'); $metadata = $this->getContainer()->get('metadata'); $fieldManager = $this->getContainer()->get('fieldManager'); $portal = $this->getContainer()->get('portal'); $this->tableHashMap[$key] = new $this->tableClassName($user, $portal, $config, $fileManager, $metadata, $fieldManager); } return $this->tableHashMap[$key]; } public function checkReadOnlyAccount(User $user, $scope) { if ($user->isAdmin()) { return false; } $data = $this->getTable($user)->getScopeData($scope); return $this->getImplementation($scope)->checkReadOnlyAccount($user, $data); } public function checkReadOnlyContact(User $user, $scope) { if ($user->isAdmin()) { return false; } $data = $this->getTable($user)->getScopeData($scope); return $this->getImplementation($scope)->checkReadOnlyContact($user, $data); } public function checkInAccount(User $user, Entity $entity, $action) { return $this->getImplementation($entity->getEntityType())->checkInAccount($user, $entity); } public function checkIsOwnContact(User $user, Entity $entity, $action) { return $this->getImplementation($entity->getEntityType())->checkIsOwnContact($user, $entity); } }