Ejemplo n.º 1
0
 /**
  *
  * @param \Zoop\Shard\Freeze\FreezerEventArgs $eventArgs
  */
 public function postThaw(FreezerEventArgs $eventArgs)
 {
     $document = $eventArgs->getDocument();
     $metadata = $eventArgs->getMetadata();
     $freezeMetadata = $metadata->getFreeze();
     if (isset($freezeMetadata['thawedBy'])) {
         $metadata->setFieldValue($document, $freezeMetadata['thawedBy'], $this->getUsername());
     }
     if (isset($freezeMetadata['thawedOn'])) {
         $metadata->setFieldValue($document, $freezeMetadata['thawedOn'], time());
     }
 }
Ejemplo n.º 2
0
 /**
  *
  * @param  \Zoop\Shard\Freeze\FreezerEventArgs $eventArgs
  * @return type
  */
 public function preThaw(FreezerEventArgs $eventArgs)
 {
     if (!($accessController = $this->getAccessController())) {
         //Access control is not enabled
         return;
     }
     $document = $eventArgs->getDocument();
     $metadata = $eventArgs->getMetadata();
     if (!$accessController->areAllowed([Actions::THAW], $metadata, $document)->getAllowed()) {
         //stop thaw
         $this->getFreezer()->freeze($document, $metadata);
         $eventArgs->getEventManager()->dispatchEvent(Events::THAW_DENIED, new AccessControlEventArgs($document, Actions::THAW));
         $eventArgs->setReject(true);
     }
 }
Ejemplo n.º 3
0
 public function preThaw(FreezerEventArgs $eventArgs)
 {
     $this->calls[Events::PRE_THAW] = $eventArgs;
     if ($this->rollbackThaw) {
         $eventArgs->setReject(true);
     }
 }