summaryrefslogtreecommitdiff
path: root/plugins/kolab_auth
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-11-17 13:33:04 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-11-17 13:33:04 (GMT)
commita976842f0389e8a724eb09005b6edd10400c661d (patch)
tree50523fe7eb5eab6f8b09ff0c3bb8ae1a93b4d5aa /plugins/kolab_auth
parentb9f8f0cf436d8f77e21cad89325ad1fac89b68ff (diff)
downloadroundcubemail-plugins-kolab-a976842f0389e8a724eb09005b6edd10400c661d.tar.gz
Allow to limit user search (from new folder navigation) in multi-domain setups:
Provide the 'kolab_users_directory' config option with placeholders %dc, %d, %u, %fu or %dn in base_dn or filter properties.
Diffstat (limited to 'plugins/kolab_auth')
-rw-r--r--plugins/kolab_auth/kolab_auth.php30
1 files changed, 23 insertions, 7 deletions
diff --git a/plugins/kolab_auth/kolab_auth.php b/plugins/kolab_auth/kolab_auth.php
index fa70ee9..5c6e3b0 100644
--- a/plugins/kolab_auth/kolab_auth.php
+++ b/plugins/kolab_auth/kolab_auth.php
@@ -127,21 +127,37 @@ 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
*/