summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Api/Procedure/ProjectMetaDataProcedure.php38
-rw-r--r--app/ServiceProvider/ApiProvider.php2
2 files changed, 40 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);
+ }
+}
diff --git a/app/ServiceProvider/ApiProvider.php b/app/ServiceProvider/ApiProvider.php
index 2c9abec7..1bcb580a 100644
--- a/app/ServiceProvider/ApiProvider.php
+++ b/app/ServiceProvider/ApiProvider.php
@@ -10,6 +10,7 @@ use Kanboard\Api\Procedure\CategoryProcedure;
use Kanboard\Api\Procedure\ColumnProcedure;
use Kanboard\Api\Procedure\CommentProcedure;
use Kanboard\Api\Procedure\ProjectFileProcedure;
+use Kanboard\Api\Procedure\ProjectMetadataProcedure;
use Kanboard\Api\Procedure\TagProcedure;
use Kanboard\Api\Procedure\TaskExternalLinkProcedure;
use Kanboard\Api\Procedure\TaskFileProcedure;
@@ -66,6 +67,7 @@ class ApiProvider implements ServiceProviderInterface
->withObject(new LinkProcedure($container))
->withObject(new ProjectProcedure($container))
->withObject(new ProjectPermissionProcedure($container))
+ ->withObject(new ProjectMetadataProcedure($container))
->withObject(new SubtaskProcedure($container))
->withObject(new SubtaskTimeTrackingProcedure($container))
->withObject(new SwimlaneProcedure($container))