diff options
author | Julien Moreau <thylogal@gmail.com> | 2018-04-04 20:37:52 +0200 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2018-04-04 11:37:52 -0700 |
commit | 62178b1f2b4ad6ed8eafbcd3be8ef2f46b041b82 (patch) | |
tree | 2bb345a44d349c1b940b75f7629f1f65bf53b83b /app/Api | |
parent | c84378648f3dede4c30bea9a5e549dafd563adc7 (diff) |
Add Project MetaData API calls
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); + } +} |