EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Formula relate write access check
Yurii80dc443f913e
diff --git a/application/Espo/Core/Formula/Functions/RecordGroup/RelateType.php b/application/Espo/Core/Formula/Functions/RecordGroup/RelateType.phpindex a870828888..41e305db96 100644--- a/application/Espo/Core/Formula/Functions/RecordGroup/RelateType.php+++ b/application/Espo/Core/Formula/Functions/RecordGroup/RelateType.php@@ -123,6 +123,10 @@ class RelateType extends BaseFunction implements{$restriction = $this->injectableFactory->create(SystemRestriction::class);+ if (!$restriction->checkEntityTypeWrite($entityType)) {+ throw new NotAllowedUsage("Cannot write '$entityType'.");+ }+if (!$restriction->checkLinkWrite($entityType, $link) ) {throw new NotAllowedUsage("Cannot write restricted link $entityType.$link.");}diff --git a/application/Espo/Core/Formula/Functions/RecordGroup/UnrelateType.php b/application/Espo/Core/Formula/Functions/RecordGroup/UnrelateType.phpindex b6d1c5a797..3bd019d333 100644--- a/application/Espo/Core/Formula/Functions/RecordGroup/UnrelateType.php+++ b/application/Espo/Core/Formula/Functions/RecordGroup/UnrelateType.php@@ -99,6 +99,10 @@ class UnrelateType extends BaseFunction implements{$restriction = $this->injectableFactory->create(SystemRestriction::class);+ if (!$restriction->checkEntityTypeWrite($entityType)) {+ throw new NotAllowedUsage("Cannot write '$entityType'.");+ }+if (!$restriction->checkLinkWrite($entityType, $link) ) {throw new NotAllowedUsage("Cannot write restricted link $entityType.$link.");}diff --git a/application/Espo/Core/Formula/Functions/RecordGroup/UpdateRelationColumnType.php b/application/Espo/Core/Formula/Functions/RecordGroup/UpdateRelationColumnType.phpindex f18e3b574b..986eece1a2 100644--- a/application/Espo/Core/Formula/Functions/RecordGroup/UpdateRelationColumnType.php+++ b/application/Espo/Core/Formula/Functions/RecordGroup/UpdateRelationColumnType.php@@ -111,6 +111,10 @@ class UpdateRelationColumnType extends BaseFunction implements{$restriction = $this->injectableFactory->create(SystemRestriction::class);+ if (!$restriction->checkEntityTypeWrite($entityType)) {+ throw new NotAllowedUsage("Cannot write '$entityType'.");+ }+if (!$restriction->checkLinkWrite($entityType, $link) ) {throw new NotAllowedUsage("Cannot write restricted link $entityType.$link.");}