summaryrefslogtreecommitdiffstats
path: root/lib/api
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2012-03-14 14:55:09 +0100
committerAleksander Machniak <machniak@kolabsys.com>2012-03-14 14:55:09 +0100
commit4872803486f298b98fb282c83c5c280201a0424c (patch)
tree8a7b605082547fce4f1491bd619d6584d5d78b0c /lib/api
parent5b95b56165eddd823b5e3d8e5ee1489d4aa43c5c (diff)
downloadwebadmin-4872803486f298b98fb282c83c5c280201a0424c.tar.gz
Move user type detection to service class, return type id in user.info result
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/kolab_api_service_user.php7
-rw-r--r--lib/api/kolab_api_service_user_types.php18
2 files changed, 7 insertions, 18 deletions
diff --git a/lib/api/kolab_api_service_user.php b/lib/api/kolab_api_service_user.php
index 903771e..32f6b22 100644
--- a/lib/api/kolab_api_service_user.php
+++ b/lib/api/kolab_api_service_user.php
@@ -114,7 +114,12 @@ class kolab_api_service_user extends kolab_api_service
}
$auth = Auth::get_instance();
- $result = $auth->user_info($getdata['user']);
+ $user = $getdata['user'];
+ $result = $auth->user_info($user);
+
+ // add user type id to the result
+ $objectclass = $result[$user]['objectclass'];
+ $result[$user]['user_type_id'] = $this->user_type_id($objectclass);
if ($result) {
return $result;
diff --git a/lib/api/kolab_api_service_user_types.php b/lib/api/kolab_api_service_user_types.php
index 1c5a6c4..164e872 100644
--- a/lib/api/kolab_api_service_user_types.php
+++ b/lib/api/kolab_api_service_user_types.php
@@ -37,23 +37,7 @@ class kolab_api_service_user_types extends kolab_api_service
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;
- }
- }
- }
- }
+ $user_types = $this->user_types();
return array(
'list' => $user_types,