diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-05-27 12:18:05 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-05-27 12:18:05 -0400 |
commit | ad8b1223cc7c4dbfc7245d630d1b4f4831a8c80f (patch) | |
tree | e74458231440a3b79fb7a6af263c2e88c70011ce /app/Model/ProjectModel.php | |
parent | 80d1293c42d5d7db1af278c2fbf12273dad4ba5f (diff) |
Check owner existence before to create project
Diffstat (limited to 'app/Model/ProjectModel.php')
-rw-r--r-- | app/Model/ProjectModel.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/Model/ProjectModel.php b/app/Model/ProjectModel.php index 7f55a9fb..097806d8 100644 --- a/app/Model/ProjectModel.php +++ b/app/Model/ProjectModel.php @@ -355,6 +355,10 @@ class ProjectModel extends Base */ public function create(array $values, $userId = 0, $addUser = false) { + if (! empty($userId) && ! $this->userModel->exists($userId)) { + return false; + } + $this->db->startTransaction(); $values['token'] = ''; @@ -447,6 +451,10 @@ class ProjectModel extends Base $values['end_date'] = $this->dateParser->getIsoDate($values['end_date']); } + if (! empty($values['owner_id']) && ! $this->userModel->exists($values['owner_id'])) { + return false; + } + $this->helper->model->convertIntegerFields($values, array('priority_default', 'priority_start', 'priority_end')); return $this->exists($values['id']) && |