diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-05-15 18:31:47 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-05-15 18:31:47 -0400 |
commit | 67b836164997527b91452b19adbcb8aa3c5decf1 (patch) | |
tree | b5876d311912e97b0592c7e208639f7b52813a75 /app/Controller/Column.php | |
parent | 108e867605dbc7ece4cbcbecc89a674e9c154a9b (diff) |
Refactoring: added controlled middleware and changed response class
Diffstat (limited to 'app/Controller/Column.php')
-rw-r--r-- | app/Controller/Column.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/app/Controller/Column.php b/app/Controller/Column.php index bbe12fe1..294c31d8 100644 --- a/app/Controller/Column.php +++ b/app/Controller/Column.php @@ -2,13 +2,15 @@ namespace Kanboard\Controller; +use Kanboard\Core\Controller\AccessForbiddenException; + /** * Column controller * * @package controller * @author Frederic Guillot */ -class Column extends Base +class Column extends BaseController { /** * Display columns list @@ -31,6 +33,9 @@ class Column extends Base * Show form to create a new column * * @access public + * @param array $values + * @param array $errors + * @throws \Kanboard\Core\Controller\PageNotFoundException */ public function create(array $values = array(), array $errors = array()) { @@ -69,7 +74,7 @@ class Column extends Base } } - $this->create($values, $errors); + return $this->create($values, $errors); } /** @@ -108,13 +113,13 @@ class Column extends Base if ($valid) { if ($this->column->update($values['id'], $values['title'], $values['task_limit'], $values['description'])) { $this->flash->success(t('Board updated successfully.')); - $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id']))); + return $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id']))); } else { $this->flash->failure(t('Unable to update this board.')); } } - $this->edit($values, $errors); + return $this->edit($values, $errors); } /** @@ -129,10 +134,10 @@ class Column extends Base if (! empty($values) && isset($values['column_id']) && isset($values['position'])) { $result = $this->column->changePosition($project['id'], $values['column_id'], $values['position']); - return $this->response->json(array('result' => $result)); + $this->response->json(array('result' => $result)); + } else { + throw new AccessForbiddenException(); } - - $this->forbidden(); } /** |