diff --git a/plugins/kolab_auth/kolab_auth.php b/plugins/kolab_auth/kolab_auth.php index fa70ee9c..5c6e3b0a 100644 --- a/plugins/kolab_auth/kolab_auth.php +++ b/plugins/kolab_auth/kolab_auth.php @@ -127,20 +127,36 @@ class kolab_auth extends rcube_plugin foreach ($args['result'] as $name => $config) { if (in_array($name, $kolab_books) || in_array('*', $kolab_books)) { - $args['result'][$name]['base_dn'] = self::parse_ldap_vars($config['base_dn']); - $args['result'][$name]['search_base_dn'] = self::parse_ldap_vars($config['search_base_dn']); - $args['result'][$name]['bind_dn'] = str_replace('%dn', $_SESSION['kolab_dn'], $config['bind_dn']); - - if (!empty($config['groups'])) { - $args['result'][$name]['groups']['base_dn'] = self::parse_ldap_vars($config['groups']['base_dn']); - } + $args['result'][$name] = $this->patch_ldap_config($config); } } } + else if ($args['name'] == 'kolab_users_directory' && !empty($args['result'])) { + console($args); + $args['result'] = $this->patch_ldap_config($args['result']); + } return $args; } + /** + * Helper method to patch the given LDAP directory config with user-specific values + */ + protected function patch_ldap_config($config) + { + if (is_array($config)) { + $config['base_dn'] = self::parse_ldap_vars($config['base_dn']); + $config['search_base_dn'] = self::parse_ldap_vars($config['search_base_dn']); + $config['bind_dn'] = str_replace('%dn', $_SESSION['kolab_dn'], $config['bind_dn']); + + if (!empty($config['groups'])) { + $config['groups']['base_dn'] = self::parse_ldap_vars($config['groups']['base_dn']); + } + } + + return $config; + } + /** * Modifies list of plugins and settings according to * specified LDAP roles diff --git a/plugins/libkolab/config.inc.php.dist b/plugins/libkolab/config.inc.php.dist index 79d2aa84..7efa8d1c 100644 --- a/plugins/libkolab/config.inc.php.dist +++ b/plugins/libkolab/config.inc.php.dist @@ -38,6 +38,7 @@ $config['kolab_messages_cache_bypass'] = 0; // LDAP directory to find avilable users for folder sharing. // Either contains an array with LDAP addressbook configuration or refers to entry in $config['ldap_public']. // If not specified, the configuraton from 'kolab_auth_addressbook' will be used. +// Should be provided for multi-domain setups with placeholders like %dc, %d, %u, %fu or %dn. $config['kolab_users_directory'] = null; // Filter to be used for resolving user folders in LDAP.