Beispiel #1
0
 /**
  * save
  *
  * @param int|string $pk
  * @param Data       $data
  *
  * @return mixed|void
  *
  * @throws ValidFailException
  */
 protected function save($pk, Data $data)
 {
     if (!UserHelper::canEditTopic($this->record)) {
         throw new ValidFailException('Permission deny');
     }
     parent::save($pk, $data);
 }
Beispiel #2
0
 /**
  * save
  *
  * @param int|string $pk
  * @param Data       $data
  *
  * @return  void
  *
  * @throws ValidFailException
  */
 protected function save($pk, Data $data)
 {
     // Validate
     if (!UserHelper::isAdmin()) {
         throw new ValidFailException('Permission deny');
     }
     parent::save($pk, $data);
 }
Beispiel #3
0
 /**
  * save
  *
  * @param int|string $pk
  * @param Data       $data
  *
  * @return  void
  *
  * @throws ValidFailException
  */
 protected function save($pk, Data $data)
 {
     // Pre save
     if (!UserHelper::canDeletePost($this->record)) {
         throw new ValidFailException('Permission deny');
     }
     if ($this->primary) {
         $this->hmvc($controller = new TopicDeleteController(), array('cid' => $this->record->topic_id));
     } else {
         parent::save($pk, $data);
     }
     // Post save
     $this->topic->replies--;
     $this->topic->store();
 }