summaryrefslogtreecommitdiff
path: root/app/Api/Procedure
diff options
context:
space:
mode:
Diffstat (limited to 'app/Api/Procedure')
-rw-r--r--app/Api/Procedure/TagProcedure.php44
-rw-r--r--app/Api/Procedure/TaskProcedure.php14
-rw-r--r--app/Api/Procedure/TaskTagProcedure.php26
3 files changed, 78 insertions, 6 deletions
diff --git a/app/Api/Procedure/TagProcedure.php b/app/Api/Procedure/TagProcedure.php
new file mode 100644
index 00000000..f1c06d01
--- /dev/null
+++ b/app/Api/Procedure/TagProcedure.php
@@ -0,0 +1,44 @@
+<?php
+
+namespace Kanboard\Api\Procedure;
+
+use Kanboard\Api\Authorization\ProjectAuthorization;
+use Kanboard\Api\Authorization\TagAuthorization;
+
+/**
+ * Class TagProcedure
+ *
+ * @package Kanboard\Api\Procedure
+ * @author Frederic Guillot
+ */
+class TagProcedure extends BaseProcedure
+{
+ public function getAllTags()
+ {
+ return $this->tagModel->getAll();
+ }
+
+ public function getTagsByProject($project_id)
+ {
+ ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getTagsByProject', $project_id);
+ return $this->tagModel->getAllByProject($project_id);
+ }
+
+ public function createTag($project_id, $tag)
+ {
+ ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'createTag', $project_id);
+ return $this->tagModel->findOrCreateTag($project_id, $tag);
+ }
+
+ public function updateTag($tag_id, $tag)
+ {
+ TagAuthorization::getInstance($this->container)->check($this->getClassName(), 'updateTag', $tag_id);
+ return $this->tagModel->update($tag_id, $tag);
+ }
+
+ public function removeTag($tag_id)
+ {
+ TagAuthorization::getInstance($this->container)->check($this->getClassName(), 'removeTag', $tag_id);
+ return $this->tagModel->remove($tag_id);
+ }
+}
diff --git a/app/Api/Procedure/TaskProcedure.php b/app/Api/Procedure/TaskProcedure.php
index ee9242d1..af67f3de 100644
--- a/app/Api/Procedure/TaskProcedure.php
+++ b/app/Api/Procedure/TaskProcedure.php
@@ -87,9 +87,9 @@ class TaskProcedure extends BaseProcedure
}
public function createTask($title, $project_id, $color_id = '', $column_id = 0, $owner_id = 0, $creator_id = 0,
- $date_due = '', $description = '', $category_id = 0, $score = 0, $swimlane_id = 0, $priority = 0,
- $recurrence_status = 0, $recurrence_trigger = 0, $recurrence_factor = 0, $recurrence_timeframe = 0,
- $recurrence_basedate = 0, $reference = '')
+ $date_due = '', $description = '', $category_id = 0, $score = 0, $swimlane_id = 0, $priority = 0,
+ $recurrence_status = 0, $recurrence_trigger = 0, $recurrence_factor = 0, $recurrence_timeframe = 0,
+ $recurrence_basedate = 0, $reference = '', array $tags = array())
{
ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'createTask', $project_id);
@@ -120,6 +120,7 @@ class TaskProcedure extends BaseProcedure
'recurrence_basedate' => $recurrence_basedate,
'reference' => $reference,
'priority' => $priority,
+ 'tags' => $tags,
);
list($valid, ) = $this->taskValidator->validateCreation($values);
@@ -128,9 +129,9 @@ class TaskProcedure extends BaseProcedure
}
public function updateTask($id, $title = null, $color_id = null, $owner_id = null,
- $date_due = null, $description = null, $category_id = null, $score = null, $priority = null,
- $recurrence_status = null, $recurrence_trigger = null, $recurrence_factor = null,
- $recurrence_timeframe = null, $recurrence_basedate = null, $reference = null)
+ $date_due = null, $description = null, $category_id = null, $score = null, $priority = null,
+ $recurrence_status = null, $recurrence_trigger = null, $recurrence_factor = null,
+ $recurrence_timeframe = null, $recurrence_basedate = null, $reference = null, $tags = null)
{
TaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'updateTask', $id);
$project_id = $this->taskFinderModel->getProjectId($id);
@@ -159,6 +160,7 @@ class TaskProcedure extends BaseProcedure
'recurrence_basedate' => $recurrence_basedate,
'reference' => $reference,
'priority' => $priority,
+ 'tags' => $tags,
));
list($valid) = $this->taskValidator->validateApiModification($values);
diff --git a/app/Api/Procedure/TaskTagProcedure.php b/app/Api/Procedure/TaskTagProcedure.php
new file mode 100644
index 00000000..8596f507
--- /dev/null
+++ b/app/Api/Procedure/TaskTagProcedure.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Kanboard\Api\Procedure;
+
+use Kanboard\Api\Authorization\TaskAuthorization;
+
+/**
+ * Class TaskTagProcedure
+ *
+ * @package Kanboard\Api\Procedure
+ * @author Frederic Guillot
+ */
+class TaskTagProcedure extends BaseProcedure
+{
+ public function setTaskTags($project_id, $task_id, array $tags)
+ {
+ TaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'setTaskTags', $task_id);
+ return $this->taskTagModel->save($project_id, $task_id, $tags);
+ }
+
+ public function getTaskTags($task_id)
+ {
+ TaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'getTaskTags', $task_id);
+ return $this->taskTagModel->getList($task_id);
+ }
+}