summaryrefslogtreecommitdiffstats
path: root/lib/api/kolab_api_service_user_types.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-02-17 14:54:42 +0100
committerAleksander Machniak <alec@alec.pl>2012-02-17 14:54:42 +0100
commit2727724ed788471bc3b43d2227ee153db9e80190 (patch)
tree2400a8086abe3688c2100564438509da493f9f54 /lib/api/kolab_api_service_user_types.php
parente08072b6994af0b943e63815655fab0557453c9b (diff)
downloadwebadmin-2727724ed788471bc3b43d2227ee153db9e80190.tar.gz
Class filenames unification
Diffstat (limited to 'lib/api/kolab_api_service_user_types.php')
-rw-r--r--lib/api/kolab_api_service_user_types.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/api/kolab_api_service_user_types.php b/lib/api/kolab_api_service_user_types.php
new file mode 100644
index 0000000..b7dd5d6
--- /dev/null
+++ b/lib/api/kolab_api_service_user_types.php
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ *
+ */
+class kolab_api_service_user_types extends kolab_api_service
+{
+ public function capabilities($domain)
+ {
+ return array(
+ 'list' => 'r',
+ );
+ }
+
+ public function user_types_list($get, $post)
+ {
+ $sql_result = $this->db->query("SELECT * FROM user_types");
+ $user_types = array();
+
+ while ($row = $this->db->fetch_assoc($sql_result)) {
+ $user_types[$row['id']] = array();
+
+ foreach ($row as $key => $value) {
+ if ($key != "id") {
+ if ($key == "attributes") {
+ $user_types[$row['id']][$key] = json_decode(unserialize($value), true);
+ }
+ else {
+ $user_types[$row['id']][$key] = $value;
+ }
+ }
+ }
+ }
+
+ return array(
+ 'list' => $user_types,
+ 'count' => count($user_types),
+ );
+ }
+}