Loading Core/Comments/Manager.php +1 −1 Original line number Original line Diff line number Diff line Loading @@ -126,7 +126,7 @@ class Manager $owner = $comment->getOwnerEntity(false); $owner = $comment->getOwnerEntity(false); if (!$this->acl->interact($entity->guid, $owner, "comment")) { if (!$this->acl->interact($entity, $owner, "comment")) { throw new \Exception(); throw new \Exception(); } } Loading Core/Groups/Events.php +11 −0 Original line number Original line Diff line number Diff line Loading @@ -75,6 +75,17 @@ class Events $e->setResponse(($group->isOwner($user->guid) || $group->isModerator($user->guid)) && $group->isMember($user->guid)); $e->setResponse(($group->isOwner($user->guid) || $group->isModerator($user->guid)) && $group->isMember($user->guid)); }); }); Dispatcher::register('acl:interact', 'group', function ($e) { $params = $e->getParameters(); $group = $params['entity']; $user = $params['user']; $interaction = $params['interaction']; if ($group instanceof GroupEntity && $interaction === 'comment') { $e->setResponse($group->isMember($user->guid)); } }); Dispatcher::register('delete', 'activity', function ($e) { Dispatcher::register('delete', 'activity', function ($e) { $params = $e->getParameters(); $params = $e->getParameters(); $activity = $params['entity']; $activity = $params['entity']; Loading Spec/Core/Comments/ManagerSpec.php +9 −9 Original line number Original line Diff line number Diff line Loading @@ -102,11 +102,11 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn($entity); ->willReturn($entity); $entity->get('guid') /*$entity->get('guid') ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5000); ->willReturn(5000);*/ $this->acl->interact(5000, $owner, 'comment') $this->acl->interact($entity, $owner, 'comment') ->shouldBeCalled() ->shouldBeCalled() ->willReturn(true); ->willReturn(true); Loading Loading @@ -169,11 +169,11 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn($entity); ->willReturn($entity); $entity->get('guid') /*$entity->get('guid') ->shouldBeCalled() ->shouldBeCalled() ->willReturn(100); ->willReturn(100);*/ $this->acl->interact(100, $owner, "comment") $this->acl->interact($entity, $owner, "comment") ->shouldBeCalled() ->shouldBeCalled() ->willReturn(false); ->willReturn(false); Loading Loading @@ -204,11 +204,11 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn($entity); ->willReturn($entity); $entity->get('guid') /*$entity->get('guid') ->shouldBeCalled() ->shouldBeCalled() ->willReturn(100); ->willReturn(100);*/ $this->acl->interact(100, $owner, "comment") $this->acl->interact($entity, $owner, "comment") ->shouldBeCalled() ->shouldBeCalled() ->willReturn(true); ->willReturn(true); Loading Loading
Core/Comments/Manager.php +1 −1 Original line number Original line Diff line number Diff line Loading @@ -126,7 +126,7 @@ class Manager $owner = $comment->getOwnerEntity(false); $owner = $comment->getOwnerEntity(false); if (!$this->acl->interact($entity->guid, $owner, "comment")) { if (!$this->acl->interact($entity, $owner, "comment")) { throw new \Exception(); throw new \Exception(); } } Loading
Core/Groups/Events.php +11 −0 Original line number Original line Diff line number Diff line Loading @@ -75,6 +75,17 @@ class Events $e->setResponse(($group->isOwner($user->guid) || $group->isModerator($user->guid)) && $group->isMember($user->guid)); $e->setResponse(($group->isOwner($user->guid) || $group->isModerator($user->guid)) && $group->isMember($user->guid)); }); }); Dispatcher::register('acl:interact', 'group', function ($e) { $params = $e->getParameters(); $group = $params['entity']; $user = $params['user']; $interaction = $params['interaction']; if ($group instanceof GroupEntity && $interaction === 'comment') { $e->setResponse($group->isMember($user->guid)); } }); Dispatcher::register('delete', 'activity', function ($e) { Dispatcher::register('delete', 'activity', function ($e) { $params = $e->getParameters(); $params = $e->getParameters(); $activity = $params['entity']; $activity = $params['entity']; Loading
Spec/Core/Comments/ManagerSpec.php +9 −9 Original line number Original line Diff line number Diff line Loading @@ -102,11 +102,11 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn($entity); ->willReturn($entity); $entity->get('guid') /*$entity->get('guid') ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5000); ->willReturn(5000);*/ $this->acl->interact(5000, $owner, 'comment') $this->acl->interact($entity, $owner, 'comment') ->shouldBeCalled() ->shouldBeCalled() ->willReturn(true); ->willReturn(true); Loading Loading @@ -169,11 +169,11 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn($entity); ->willReturn($entity); $entity->get('guid') /*$entity->get('guid') ->shouldBeCalled() ->shouldBeCalled() ->willReturn(100); ->willReturn(100);*/ $this->acl->interact(100, $owner, "comment") $this->acl->interact($entity, $owner, "comment") ->shouldBeCalled() ->shouldBeCalled() ->willReturn(false); ->willReturn(false); Loading Loading @@ -204,11 +204,11 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn($entity); ->willReturn($entity); $entity->get('guid') /*$entity->get('guid') ->shouldBeCalled() ->shouldBeCalled() ->willReturn(100); ->willReturn(100);*/ $this->acl->interact(100, $owner, "comment") $this->acl->interact($entity, $owner, "comment") ->shouldBeCalled() ->shouldBeCalled() ->willReturn(true); ->willReturn(true); Loading