diff --git a/application/Espo/Core/Record/Service.php b/application/Espo/Core/Record/Service.php index 2091f432a4..fb9a6337dd 100644 --- a/application/Espo/Core/Record/Service.php +++ b/application/Espo/Core/Record/Service.php @@ -810,14 +810,10 @@ class Service implements Crud, $this->sanitizeInput($data); $entity->set($data); - $this->populateDefaults($entity, $data); - if (!$this->acl->check($entity, AclTable::ACTION_CREATE)) { - throw new ForbiddenSilent("No create access."); - } - $this->processValidation($entity, $data); + $this->checkEntityCreateAccess($entity); $this->processAssignmentCheck($entity); $this->getLinkCheck()->processFields($entity); @@ -2047,4 +2043,14 @@ class Service implements Crud, return $this->recordHookManager; } + + /** + * @throws Forbidden + */ + private function checkEntityCreateAccess(Entity $entity): void + { + if (!$this->acl->check($entity, AclTable::ACTION_CREATE)) { + throw new ForbiddenSilent("No create access."); + } + } }