Formula relate write access check

This commit is contained in:
Yurii
2026-05-22 12:26:29 +03:00
parent 67763ac574
commit 80dc443f91
3 changed files with 12 additions and 0 deletions

View File

@@ -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.");
}

View File

@@ -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.");
}

View File

@@ -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.");
}