summaryrefslogtreecommitdiffstats
path: root/lib/api/kolab_api_service_user.php
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2012-03-26 10:45:27 +0200
committerAleksander Machniak <machniak@kolabsys.com>2012-03-26 10:45:27 +0200
commitdc6628c308868b1091439b1e16ec1c45548c64ed (patch)
tree3cee88edc155644d7b07c996087fa9868e74a30c /lib/api/kolab_api_service_user.php
parent4faca4946e79246feaa8939a3906981dca368ad6 (diff)
downloadwebadmin-dc6628c308868b1091439b1e16ec1c45548c64ed.tar.gz
Limit ldap_search() calls by fetching all extra user attributes in one call
Diffstat (limited to 'lib/api/kolab_api_service_user.php')
-rw-r--r--lib/api/kolab_api_service_user.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/api/kolab_api_service_user.php b/lib/api/kolab_api_service_user.php
index 61cd7ce..8c60d33 100644
--- a/lib/api/kolab_api_service_user.php
+++ b/lib/api/kolab_api_service_user.php
@@ -159,18 +159,23 @@ class kolab_api_service_user extends kolab_api_service
// Search for attributes associated with the type_id that are not part
// of the results returned earlier. Example: nsrole / nsroledn / aci, etc.
if ($result['user_type_id']) {
- $uta = $this->user_type_attributes($result['user_type_id']);
+ $uta = $this->user_type_attributes($result['user_type_id']);
+ $attrs = array();
foreach ($uta as $field_type => $attributes) {
foreach ($attributes as $attribute => $data) {
if (!array_key_exists($attribute, $result)) {
- $attribute_value = $auth->user_get_attribute($result['entrydn'], $attribute);
- if ($attribute_value) {
- $result[$attribute] = $attribute_value;
- }
+ $attrs[] = $attribute;
}
}
}
+
+ if (!empty($attrs)) {
+ $attrs = $auth->user_attributes($result['entrydn'], $attrs);
+ if (!empty($attrs)) {
+ $result = array_merge($result, $attrs);
+ }
+ }
}
if ($result) {