diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-12-17 17:02:29 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-12-17 17:02:29 -0500 |
commit | 11861044695e5a6553e5ca2b4db8f2fd57702f7f (patch) | |
tree | 08ef63bd6d0a3f8e625f14e616088775f7d0bf61 /app/Api/Procedure | |
parent | ddeb89e2c6622f197d1b7738042182b34d5054ed (diff) |
Add API calls to manage tags
Diffstat (limited to 'app/Api/Procedure')
-rw-r--r-- | app/Api/Procedure/TagProcedure.php | 44 | ||||
-rw-r--r-- | app/Api/Procedure/TaskTagProcedure.php | 26 |
2 files changed, 70 insertions, 0 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/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); + } +} |