summaryrefslogtreecommitdiff
path: root/app/Api/Procedure/TagProcedure.php
blob: f1c06d0137fd7f5a2774d510cb5f0c9edb30b1ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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);
    }
}