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.
This commit is contained in:
Thomas Bruederli 2014-11-17 14:33:04 +01:00
parent b9f8f0cf43
commit a976842f03
2 changed files with 24 additions and 7 deletions

View file

@ -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

View file

@ -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.