summaryrefslogtreecommitdiff
path: root/app/Api
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-02-18 10:11:07 -0500
committerFrederic Guillot <fred@kanboard.net>2017-02-18 10:11:07 -0500
commit948b7fbaaa58c0a825938f7e8bda9a07ec39239b (patch)
tree15eb1d245dac847d92c606fff85c65a7d9e0f79b /app/Api
parentde128dbad860478496a0d655b5eb5c1005ebbabe (diff)
Add mandatory argument "project_id" to API method "updateSwimlane()"
Diffstat (limited to 'app/Api')
-rw-r--r--app/Api/Procedure/SwimlaneProcedure.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/app/Api/Procedure/SwimlaneProcedure.php b/app/Api/Procedure/SwimlaneProcedure.php
index 25b1efb0..edc1e006 100644
--- a/app/Api/Procedure/SwimlaneProcedure.php
+++ b/app/Api/Procedure/SwimlaneProcedure.php
@@ -49,15 +49,28 @@ class SwimlaneProcedure extends BaseProcedure
return $this->swimlaneModel->create($project_id, $name, $description);
}
- public function updateSwimlane($swimlane_id, $name, $description = null)
+ public function updateSwimlane($project_id, $swimlane_id, $name, $description = null)
{
- $values = array('id' => $swimlane_id, 'name' => $name);
+ ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'updateSwimlane', $project_id);
- if (!is_null($description)) {
+ $values = array(
+ 'project_id' => $project_id,
+ 'id' => $swimlane_id,
+ 'name' => $name,
+ );
+
+ if (! is_null($description)) {
$values['description'] = $description;
}
- return $this->swimlaneModel->update($values);
+ list($valid, $errors) = $this->swimlaneValidator->validateModification($values);
+
+ if (! $valid) {
+ $this->logger->debug(__METHOD__.': Validation error: '.var_export($errors, true));
+ return false;
+ }
+
+ return $this->swimlaneModel->update($swimlane_id, $values);
}
public function removeSwimlane($project_id, $swimlane_id)