summaryrefslogtreecommitdiff
path: root/app/Controller/TaskCreationController.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-09-18 21:19:48 -0400
committerFrederic Guillot <fred@kanboard.net>2016-09-18 21:19:48 -0400
commit3043163747b13ce1942b2e55977cf7c5417021de (patch)
tree31552d8bfdf3b7a6eedfaded116b863e980f86b4 /app/Controller/TaskCreationController.php
parent4bc83646b0b15bff9ae55083121f66b7a89e433d (diff)
Add column restrictions to custom project roles
Diffstat (limited to 'app/Controller/TaskCreationController.php')
-rw-r--r--app/Controller/TaskCreationController.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/Controller/TaskCreationController.php b/app/Controller/TaskCreationController.php
index c68964f6..c754b029 100644
--- a/app/Controller/TaskCreationController.php
+++ b/app/Controller/TaskCreationController.php
@@ -52,12 +52,16 @@ class TaskCreationController extends BaseController
list($valid, $errors) = $this->taskValidator->validateCreation($values);
- if ($valid && ($task_id = $this->taskCreationModel->create($values))) {
- $this->flash->success(t('Task created successfully.'));
- $this->afterSave($project, $values, $task_id);
- } else {
+ if (! $valid) {
$this->flash->failure(t('Unable to create your task.'));
$this->show($values, $errors);
+ } else if (! $this->helper->projectRole->canCreateTaskInColumn($project['id'], $values['column_id'])) {
+ $this->flash->failure(t('You cannot create tasks in this column.'));
+ $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id'])), true);
+ } else {
+ $task_id = $this->taskCreationModel->create($values);
+ $this->flash->success(t('Task created successfully.'));
+ $this->afterSave($project, $values, $task_id);
}
}