summaryrefslogtreecommitdiff
path: root/app/Api/Procedure/TaskMetadataProcedure.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-07-31 15:10:42 -0400
committerFrederic Guillot <fred@kanboard.net>2016-07-31 15:10:42 -0400
commit86c950743f2d923a37de3f3a91344dae62a1015e (patch)
tree291e1f54712946ea2a3f017249705d9aa99db712 /app/Api/Procedure/TaskMetadataProcedure.php
parent9f2ef84cd08607d1b4df0ab31f70eda65ea9ee83 (diff)
Move API calls for task metadata to a separate class
Diffstat (limited to 'app/Api/Procedure/TaskMetadataProcedure.php')
-rw-r--r--app/Api/Procedure/TaskMetadataProcedure.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/app/Api/Procedure/TaskMetadataProcedure.php b/app/Api/Procedure/TaskMetadataProcedure.php
new file mode 100644
index 00000000..169482f5
--- /dev/null
+++ b/app/Api/Procedure/TaskMetadataProcedure.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace Kanboard\Api\Procedure;
+
+use Kanboard\Api\Authorization\TaskAuthorization;
+
+/**
+ * Class TaskMetadataProcedure
+ *
+ * @package Kanboard\Api\Procedure
+ * @author Frederic Guillot
+ */
+class TaskMetadataProcedure extends BaseProcedure
+{
+ public function getTaskMetadata($task_id)
+ {
+ TaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'getTask', $task_id);
+ return $this->taskMetadataModel->getAll($task_id);
+ }
+
+ public function getTaskMetadataByName($task_id, $name)
+ {
+ TaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'getTask', $task_id);
+ return $this->taskMetadataModel->get($task_id, $name);
+ }
+
+ public function saveTaskMetadata($task_id, array $values)
+ {
+ TaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'updateTask', $task_id);
+ return $this->taskMetadataModel->save($task_id, $values);
+ }
+
+ public function removeTaskMetadata($task_id, $name)
+ {
+ TaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'updateTask', $task_id);
+ return $this->taskMetadataModel->remove($task_id, $name);
+ }
+}