Skip to content

Commit 731d669

Browse files
committed
(fix): if entity is not found, then do not continue to perform the ACL
1 parent 29ea8f5 commit 731d669

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Core/Comments/Events.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,10 @@ public function register()
138138
$parentEntity = EntitiesFactory::build($entity->getAccessId());
139139
$user = $params['user'];
140140

141-
$canRead = ACL::_()->read($parentEntity, $user);
142-
$event->setResponse($canRead);
141+
if ($parentEntity) {
142+
$canRead = ACL::_()->read($parentEntity, $user);
143+
$event->setResponse($canRead);
144+
}
143145
});
144146

145147
// If comment is container_guid then decide if we can allow writing

Helpers/Flags.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ class Flags
88
{
99
public static function shouldFail($entity)
1010
{
11+
if (!$entity) {
12+
return false;
13+
}
14+
1115
$currentUser = Core\Session::getLoggedInUserGuid();
1216
$owner = $entity instanceof User ? $entity->guid : $entity->getOwnerGuid();
1317

0 commit comments

Comments
 (0)