summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Auth.php9
-rw-r--r--lib/Auth/LDAP.php4
-rw-r--r--lib/api/kolab_api_service_group.php5
-rw-r--r--lib/api/kolab_api_service_user.php27
-rw-r--r--lib/kolab_api_controller.php2
5 files changed, 26 insertions, 21 deletions
diff --git a/lib/Auth.php b/lib/Auth.php
index 17cbd0d..9eaa498 100644
--- a/lib/Auth.php
+++ b/lib/Auth.php
@@ -173,7 +173,7 @@ class Auth {
public function group_info($groupdata)
{
- return $this->normalize_result($this->_auth[$_SESSION['user']->get_domain()]->group_info($groupdata));
+ return $this->_auth[$_SESSION['user']->get_domain()]->group_info($groupdata);
}
public function group_members_list($groupdata)
@@ -219,11 +219,6 @@ class Auth {
return $groups;
}
- public function normalize_result($results)
- {
- return LDAP::normalize_result($results);
- }
-
public function primary_for_valid_domain($domain)
{
$this->domains = $this->list_domains();
@@ -273,6 +268,6 @@ class Auth {
public function user_info($userdata)
{
- return $this->normalize_result($this->_auth[$_SESSION['user']->get_domain()]->user_info($userdata));
+ return $this->_auth[$_SESSION['user']->get_domain()]->user_info($userdata);
}
}
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 685081c..dd41176 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -352,7 +352,7 @@ class LDAP
return false;
}
- return $this->search($group_dn);
+ return $this->normalize_result($this->search($group_dn));
}
public function group_members_list($group)
@@ -641,7 +641,7 @@ class LDAP
return false;
}
- return $this->search($user_dn);
+ return $this->normalize_result($this->search($user_dn));
}
public function users_list($attributes = array(), $search = array())
diff --git a/lib/api/kolab_api_service_group.php b/lib/api/kolab_api_service_group.php
index 34843d9..9020d01 100644
--- a/lib/api/kolab_api_service_group.php
+++ b/lib/api/kolab_api_service_group.php
@@ -113,6 +113,11 @@ class kolab_api_service_group extends kolab_api_service
$auth = Auth::get_instance();
$result = $auth->group_info($getdata['group']);
+ // normalize result
+ $dn = key($result);
+ $result = $result[$dn];
+ $result['entrydn'] = $dn;
+
if ($result) {
return $result;
}
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;
+ }
}
}
}
diff --git a/lib/kolab_api_controller.php b/lib/kolab_api_controller.php
index cc23849..0880700 100644
--- a/lib/kolab_api_controller.php
+++ b/lib/kolab_api_controller.php
@@ -295,7 +295,7 @@ class kolab_api_controller
private function capabilities()
{
$auth = Auth::get_instance();
- $this->domains = $auth->normalize_result($auth->list_domains());
+ $this->domains = $auth->list_domains();
$result = array();