lib/api lib/Auth
Aleksander Machniak
machniak at kolabsys.com
Thu Dec 11 16:40:46 CET 2014
lib/Auth/LDAP.php | 12 +++++++++++-
lib/api/kolab_api_service_form_value.php | 18 ++++++++++++------
2 files changed, 23 insertions(+), 7 deletions(-)
New commits:
commit 34e98d3ce6434d5f533913493ce4ec0797881d65
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Thu Dec 11 09:47:43 2014 -0500
Fix bug where OU select field lists only 10 records when vlv index is in use (#4075)
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),
);
}
More information about the commits
mailing list