protected function validate($action, $foreignModel, $foreignKey, array $data = array())
 {
     $result = parent::validate($action, $foreignModel, $foreignKey, $data);
     if ($data[$this->context]['type'] != 'user') {
         $result = false;
     }
     return $result;
 }
示例#2
0
 public function add($action, $foreignModel, $foreignKey, array $data = array())
 {
     $result = parent::validate($action, $foreignModel, $foreignKey, $data);
     if (!$data[$this->context]['published']) {
         $result = false;
     }
     return $result;
 }
 protected function addComment($action, $foreignModel, $foreignKey, array $data = array())
 {
     $result = parent::validate($action, $foreignModel, $foreignKey, $data);
     $projectEventModel = ClassRegistry::init('ProjectEvent');
     if ($data[$this->context]['event_type'] != $projectEventModel::TASK_COMMENT) {
         $result = false;
     }
     return $result;
 }
示例#4
0
 public function requestTo($action, $foreignModel, $foreignKey, array $data = array())
 {
     $result = parent::validate($action, $foreignModel, $foreignKey, $data);
     if ($result && $data[$this->context]['approved'] == true) {
         $result = true;
     } else {
         $result = false;
     }
     return $result;
 }
示例#5
0
 protected function close($action, $foreignModel, $foreignKey, array $data = array())
 {
     $result = parent::validate($action, $foreignModel, $foreignKey, $data);
     if ($result && !empty($data[$this->context]['closed'])) {
         $result = true;
     } elseif ($result && empty($data[$this->context]['closed'])) {
         $result = false;
     }
     return $result;
 }