diff --git a/application/Espo/Core/Acl/ScopeData.php b/application/Espo/Core/Acl/ScopeData.php index ff2c9a141d..04c21f08a4 100644 --- a/application/Espo/Core/Acl/ScopeData.php +++ b/application/Espo/Core/Acl/ScopeData.php @@ -31,6 +31,7 @@ namespace Espo\Core\Acl; use StdClass; use InvalidArgumentException; +use RuntimeException; /** * Scope data. @@ -47,6 +48,11 @@ class ScopeData { } + public function __get(string $name) + { + throw new RuntimeException("Accessing ScopeData properties is not allowed."); + } + /** * Get a raw value. * diff --git a/tests/unit/Espo/Core/Acl/ScopeDataTest.php b/tests/unit/Espo/Core/Acl/ScopeDataTest.php index ab15dd8b5e..850a3ad2c6 100644 --- a/tests/unit/Espo/Core/Acl/ScopeDataTest.php +++ b/tests/unit/Espo/Core/Acl/ScopeDataTest.php @@ -35,6 +35,7 @@ use Espo\Core\{ }; use InvalidArgumentException; +use RuntimeException; class ScopeDataTest extends \PHPUnit\Framework\TestCase { @@ -135,4 +136,13 @@ class ScopeDataTest extends \PHPUnit\Framework\TestCase $this->assertFalse($data->hasNotNo()); } + + public function testAccessingProperty() + { + $this->expectException(RuntimeException::class); + + $data = ScopeData::fromRaw(false); + + $data->read; + } }