diff options
Diffstat (limited to 'app/Api')
-rw-r--r-- | app/Api/Procedure/TaskMetadataProcedure.php | 38 | ||||
-rw-r--r-- | app/Api/Procedure/TaskProcedure.php | 2 |
2 files changed, 39 insertions, 1 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); + } +} diff --git a/app/Api/Procedure/TaskProcedure.php b/app/Api/Procedure/TaskProcedure.php index 8661deef..ee9242d1 100644 --- a/app/Api/Procedure/TaskProcedure.php +++ b/app/Api/Procedure/TaskProcedure.php @@ -92,7 +92,7 @@ class TaskProcedure extends BaseProcedure $recurrence_basedate = 0, $reference = '') { ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'createTask', $project_id); - + if ($owner_id !== 0 && ! $this->projectPermissionModel->isAssignable($project_id, $owner_id)) { return false; } |