diff options
Diffstat (limited to 'app/Api')
-rw-r--r-- | app/Api/Procedure/ProjectMetaDataProcedure.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app/Api/Procedure/ProjectMetaDataProcedure.php b/app/Api/Procedure/ProjectMetaDataProcedure.php new file mode 100644 index 00000000..19e61612 --- /dev/null +++ b/app/Api/Procedure/ProjectMetaDataProcedure.php @@ -0,0 +1,38 @@ +<?php + +namespace Kanboard\Api\Procedure; + +use Kanboard\Api\Authorization\ProjectAuthorization; + +/** + * Class ProjectMetadataProcedure + * + * @package Kanboard\Api\Procedure + * @author Frederic Guillot + */ +class ProjectMetadataProcedure extends BaseProcedure +{ + public function getProjectMetadata($project_id) + { + ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getProject', $project_id); + return (object) $this->projectMetadataModel->getAll($project_id); + } + + public function getProjectMetadataByName($project_id, $name) + { + ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getProject', $project_id); + return $this->projectMetadataModel->get($project_id, $name); + } + + public function saveProjectMetadata($project_id, array $values) + { + ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'updateProject', $project_id); + return $this->projectMetadataModel->save($project_id, $values); + } + + public function removeProjectMetadata($project_id, $name) + { + ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'updateProject', $project_id); + return $this->projectMetadataModel->remove($project_id, $name); + } +} |