summaryrefslogtreecommitdiffstats
path: root/lib/api/kolab_api_service_user.php
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2012-03-22 12:41:58 +0100
committerAleksander Machniak <machniak@kolabsys.com>2012-03-22 12:41:58 +0100
commit872efd8546d41e1d779a9eb73ec45c86a4a3068d (patch)
treedde4c6d23ab70d4395c2a6a9265f7eec8f196625 /lib/api/kolab_api_service_user.php
parent7e4ebf0372681d8ed18749d52f920b4cbfd95644 (diff)
downloadwebadmin-872efd8546d41e1d779a9eb73ec45c86a4a3068d.tar.gz
Fixed/Improved result normalization (with DN attribute handling)
Diffstat (limited to 'lib/api/kolab_api_service_user.php')
-rw-r--r--lib/api/kolab_api_service_user.php27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/api/kolab_api_service_user.php b/lib/api/kolab_api_service_user.php
index 0224b2b..142f4b4 100644
--- a/lib/api/kolab_api_service_user.php
+++ b/lib/api/kolab_api_service_user.php
@@ -117,21 +117,26 @@ class kolab_api_service_user extends kolab_api_service
$user = $getdata['user'];
$result = $auth->user_info($user);
+ // normalize result
+ $dn = key($result);
+ $result = $result[$dn];
+ $result['entrydn'] = $dn;
+
// add user type id to the result
- $objectclass = $result[$user]['objectclass'];
- $result[$user]['user_type_id'] = $this->user_type_id($objectclass);
+ $result['user_type_id'] = $this->user_type_id($result['objectclass']);
// Search for attributes associated with the type_id that are not part
// of the results returned earlier. Example: nsrole / nsroledn / aci, etc.
- $uta = $this->user_type_attributes($result[$user]['user_type_id']);
-
- foreach ($uta as $field_type => $attributes) {
- foreach ($attributes as $attribute => $data) {
- if (!array_key_exists($attribute, $result[$user])) {
- $attribute_value = $auth->user_get_attribute($user, $attribute);
- if ($attribute_value) {
- console("Got:", $attribute_value);
- $result[$user][$attribute] = $attribute_value;
+ if ($result['user_type_id']) {
+ $uta = $this->user_type_attributes($result['user_type_id']);
+
+ foreach ($uta as $field_type => $attributes) {
+ foreach ($attributes as $attribute => $data) {
+ if (!array_key_exists($attribute, $result[$user])) {
+ $attribute_value = $auth->user_get_attribute($user, $attribute);
+ if ($attribute_value) {
+ $result[$attribute] = $attribute_value;
+ }
}
}
}