Example #1
0
 public function testOnPermissionUpdateWrongType()
 {
     $event = new PermissionUpdateEvent(\stdClass::class, '1', null);
     $this->fileVersionMetaRepository->findByCollectionId(Argument::any())->shouldNotBeCalled();
     $this->searchManager->deindex(Argument::any())->shouldNotBeCalled();
     $this->permissionListener->onPermissionUpdate($event);
 }
Example #2
0
 public function onPermissionUpdate(PermissionUpdateEvent $permissionUpdateEvent)
 {
     if ($permissionUpdateEvent->getType() !== SecurityBehavior::class) {
         return;
     }
     $document = $this->documentManager->find($permissionUpdateEvent->getIdentifier());
     $this->searchManager->deindex($document);
 }
Example #3
0
 /**
  * Schedules a document to be deindexed.
  *
  * @param RemoveEvent $event
  */
 public function handlePreRemove(RemoveEvent $event)
 {
     $document = $event->getDocument();
     if (!$document instanceof StructureBehavior) {
         return;
     }
     $this->searchManager->deindex($document);
 }
 public function testHandlePreRemove()
 {
     $removeEvent = $this->prophesize(RemoveEvent::class);
     $document = $this->prophesize(StructureBehavior::class);
     $removeEvent->getDocument()->willReturn($document);
     $this->searchManager->deindex($document)->shouldBeCalled();
     $this->subscriber->handlePreRemove($removeEvent->reveal());
 }
Example #5
0
 /**
  * Removes all FileVersionMetas belonging to the collection, which just got secured.
  *
  * @param PermissionUpdateEvent $event
  */
 public function onPermissionUpdate(PermissionUpdateEvent $event)
 {
     if ($event->getType() !== Collection::class) {
         return;
     }
     foreach ($this->fileVersionMetaRepository->findByCollectionId($event->getIdentifier()) as $fileVersionMeta) {
         $this->searchManager->deindex($fileVersionMeta);
     }
 }
Example #6
0
 /**
  * Deindexes the document from the search index for the website.
  *
  * @param UnpublishEvent $event
  */
 public function deindexUnpublishedDocument(UnpublishEvent $event)
 {
     $document = $event->getDocument();
     if (!$document instanceof StructureBehavior) {
         return;
     }
     $this->searchManager->deindex($document);
 }
 public function testOnPermissionUpdateNotSecured()
 {
     $event = new PermissionUpdateEvent(\stdClass::class, '1', null);
     $this->searchManager->deindex(Argument::any())->shouldNotBeCalled();
     $this->permissionListener->onPermissionUpdate($event);
 }