summaryrefslogtreecommitdiff
path: root/app/Api/Procedure/GroupProcedure.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-06-26 10:25:13 -0400
committerFrederic Guillot <fred@kanboard.net>2016-06-26 10:25:13 -0400
commit4a230d331ec220fc32a48525afb308af0d9787fa (patch)
tree514aa3d703155b7f97a2c77147c9fd74cef60f84 /app/Api/Procedure/GroupProcedure.php
parent922e0fb6de06a98774418612e0b0f75af72b6dbb (diff)
Added application and project roles validation for API procedure calls
Diffstat (limited to 'app/Api/Procedure/GroupProcedure.php')
-rw-r--r--app/Api/Procedure/GroupProcedure.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/app/Api/Procedure/GroupProcedure.php b/app/Api/Procedure/GroupProcedure.php
new file mode 100644
index 00000000..804940a2
--- /dev/null
+++ b/app/Api/Procedure/GroupProcedure.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace Kanboard\Api\Procedure;
+
+/**
+ * Group API controller
+ *
+ * @package Kanboard\Api\Procedure
+ * @author Frederic Guillot
+ */
+class GroupProcedure extends BaseProcedure
+{
+ public function createGroup($name, $external_id = '')
+ {
+ return $this->groupModel->create($name, $external_id);
+ }
+
+ public function updateGroup($group_id, $name = null, $external_id = null)
+ {
+ $values = array(
+ 'id' => $group_id,
+ 'name' => $name,
+ 'external_id' => $external_id,
+ );
+
+ foreach ($values as $key => $value) {
+ if (is_null($value)) {
+ unset($values[$key]);
+ }
+ }
+
+ return $this->groupModel->update($values);
+ }
+
+ public function removeGroup($group_id)
+ {
+ return $this->groupModel->remove($group_id);
+ }
+
+ public function getGroup($group_id)
+ {
+ return $this->groupModel->getById($group_id);
+ }
+
+ public function getAllGroups()
+ {
+ return $this->groupModel->getAll();
+ }
+}