summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-12-11 14:47:43 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-12-11 14:47:43 (GMT)
commit34e98d3ce6434d5f533913493ce4ec0797881d65 (patch)
tree69000ce32e28ba3cd409671894f3bcf20074aedb
parentc95f7399d89b9d599adeb3a04d77da3bfc98eb02 (diff)
downloadkolab-wap-34e98d3ce6434d5f533913493ce4ec0797881d65.tar.gz
Fix bug where OU select field lists only 10 records when vlv index is in use (#4075)
-rw-r--r--lib/Auth/LDAP.php12
-rw-r--r--lib/api/kolab_api_service_form_value.php18
2 files changed, 23 insertions, 7 deletions
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 7a61524..a17263d 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -656,7 +656,7 @@ class LDAP extends Net_LDAP3 {
{
$this->_log(LOG_DEBUG, "Auth::LDAP::list_organizationalunits(" . var_export($attributes, true) . ", " . var_export($search, true) . ", " . var_export($params, true));
- $base_dn = $this->_subject_base_dn('ou');
+ $base_dn = $this->_subject_base_dn($params['type'] ? $params['type'] . '_ou' : 'ou');
$filter = $this->conf->get('ou_filter');
if (!$filter) {
@@ -1233,6 +1233,16 @@ class LDAP extends Net_LDAP3 {
$subject_base_dn = $this->conf->get_raw("ldap", $subject . "_base_dn");
}
+ // This could be "<object_type>_<object_name>", if so we'll try the name only now
+ if (empty($subject_base_dn) && ($pos = strrpos($subject, '_'))) {
+ $subject = substr($subject, $pos + 1);
+ $subject_base_dn = $this->conf->get_raw($domain, $subject . "_base_dn");
+
+ if (empty($subject_base_dn)) {
+ $subject_base_dn = $this->conf->get_raw("ldap", $subject . "_base_dn");
+ }
+ }
+
if (empty($subject_base_dn) && $strict) {
$this->_log(LOG_DEBUG, "subject_base_dn for subject $subject not found");
return null;
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index 33f0530..1459da2 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -1078,18 +1078,24 @@ class kolab_api_service_form_value extends kolab_api_service
$default = $base_dn;
}
- $_ous = array();
+ $result = array();
+ $params = array(
+ 'type' => $object_key,
+ 'page_size' => 99999,
+ );
+
+ $ous = $auth->list_organizationalunits(null, array(''), null, $params);
- if ($ous = $auth->search($base_dn, '(objectclass=organizationalunit)')) {
- foreach ($ous->entries(true) as $ou_dn => $ou_attrs) {
- $_ous[] = strtolower($ou_dn);
+ if ($ous['count']) {
+ foreach ($ous['list'] as $ou_dn => $ou_attrs) {
+ $result[] = strtolower($ou_dn);
}
- sort($_ous);
+ sort($result);
}
return array(
- 'list' => $_ous,
+ 'list' => $result,
'default' => strtolower($default),
);
}