summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-02-10 11:08:22 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-02-10 11:11:23 (GMT)
commita648e82ceea6bba8826a48e86e59525c7e6df92e (patch)
tree32c3b3a0af139a939f97a12e20858e8b2e0bf73e
parent5ea191bb16e862304a255bd6d51f116b918cf4c2 (diff)
downloadkolab-wap-a648e82ceea6bba8826a48e86e59525c7e6df92e.tar.gz
Make sure the 'ou' "attribute" is set to the parent DN, not the ou attribute value, if no value is set
-rw-r--r--lib/api/kolab_api_service_user.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/api/kolab_api_service_user.php b/lib/api/kolab_api_service_user.php
index 7b6bd0e..1d46a75 100644
--- a/lib/api/kolab_api_service_user.php
+++ b/lib/api/kolab_api_service_user.php
@@ -79,11 +79,11 @@ class kolab_api_service_user extends kolab_api_service
*/
public function user_add($getdata, $postdata)
{
- //console("user_add()", $postdata);
+ Log::trace("user_add()", $postdata);
$user_attributes = $this->parse_input_attributes('user', $postdata);
- //console("user_add()", $user_attributes);
+ Log::trace("user_add()", $user_attributes);
$auth = Auth::get_instance();
$result = $auth->user_add($user_attributes, $postdata['type_id']);
@@ -123,12 +123,12 @@ class kolab_api_service_user extends kolab_api_service
public function user_edit($getdata, $postdata)
{
- //console("\$postdata to user_edit()", $postdata);
+ Log::trace("\$postdata to user_edit()", $postdata);
$user_attributes = $this->parse_input_attributes('user', $postdata);
$user = $postdata['id'];
- //console("\$user_attributes as result from parse_input_attributes", $user_attributes);
+ Log::trace("\$user_attributes as result from parse_input_attributes", $user_attributes);
$auth = Auth::get_instance();
$result = $auth->user_edit($user, $user_attributes, $postdata['type_id']);
@@ -166,10 +166,20 @@ class kolab_api_service_user extends kolab_api_service
$auth = Auth::get_instance();
$result = $auth->user_info($getdata['id']);
+ $result_dn = key($result);
+
Log::trace("user.info on " . $getdata['id'] . " result: " . var_export($result, TRUE));
// normalize result
$result = $this->parse_result_attributes('user', $result);
+ if (empty($result['ou'])) {
+ $_dn = ldap_explode_dn($result_dn, 0);
+ // pop the count and rdn
+ unset($_dn['count']);
+ unset($_dn[0]);
+ $result['ou'] = implode(',', $_dn);
+ }
+
Log::trace("user.info on " . $getdata['id'] . " parsed result: " . var_export($result, TRUE));
if ($result) {