EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Import additinoal check
Yurii7298b220860b
diff --git a/application/Espo/Tools/Import/Import.php b/application/Espo/Tools/Import/Import.phpindex dc948abba8..1a6c26b812 100644--- a/application/Espo/Tools/Import/Import.php+++ b/application/Espo/Tools/Import/Import.php@@ -526,6 +526,14 @@ class Import}}+ $this->processAdditionalAccessCheck(+ entity: $entity,+ import: $import,+ row: $row,+ index: $index,+ errorIndex: $errorIndex,+ );+$defaultCurrency = $params->getCurrency() ?? $this->currencyConfig->getDefaultCurrency();$fieldsDefs = $this->metadata->get(['entityDefs', $entity->getEntityType(), 'fields']) ?? [];@@ -1453,4 +1461,37 @@ class Import$entity->set('emailAddressData', $emailAddressData);}}++ /**+ * @param string[] $row+ */+ private function processAdditionalAccessCheck(+ CoreEntity $entity,+ ImportEntity $import,+ $row,+ int $index,+ int $errorIndex,+ ): void {++ $noAccess = false;++ if (+ $entity instanceof User &&+ $entity->getType() === User::TYPE_SUPER_ADMIN+ ) {+ $noAccess = true;+ }++ if (!$noAccess) {+ return;+ }++ $this->createError(+ type: ImportError::TYPE_NO_ACCESS,+ index: $index,+ row: $row,+ import: $import,+ errorIndex: $errorIndex,+ );+ }}