Provide sample config for new LDAP user search
This commit is contained in:
parent
510089523e
commit
8d09b78eb1
4 changed files with 31 additions and 12 deletions
|
@ -31,3 +31,20 @@ $rcmail_config['kolab_http_request'] = array();
|
|||
// 1 - bypass only messages, but use index cache
|
||||
$rcmail_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.
|
||||
$rcmail_config['kolab_users_directory'] = null;
|
||||
|
||||
// Filter to be used for resolving user folders in LDAP.
|
||||
// Defaults to the 'kolab_auth_filter' configuration option.
|
||||
$rcmail_config['kolab_users_filter'] = '(&(objectclass=kolabInetOrgPerson)(|(uid=%u)(mail=%fu)))';
|
||||
|
||||
// Which property of the LDAP user record to use for user folder mapping in IMAP.
|
||||
// Defaults to the 'kolab_auth_login' configuration option.
|
||||
$rcmail_config['kolab_users_id_attrib'] = null;
|
||||
|
||||
// Use these attributes when searching users in LDAP
|
||||
$rcmail_config['kolab_users_search_attrib'] = array('cn','mail','alias');
|
||||
|
||||
|
||||
|
|
|
@ -111,11 +111,12 @@ class kolab_storage
|
|||
return self::$ldap;
|
||||
}
|
||||
|
||||
$rcmail = rcube::get_instance();
|
||||
$config = $rcmail->config->get('kolab_users_directory', $rcmail->config->get('kolab_auth_addressbook'));
|
||||
self::setup();
|
||||
|
||||
$config = self::$config->get('kolab_users_directory', self::$config->get('kolab_auth_addressbook'));
|
||||
|
||||
if (!is_array($config)) {
|
||||
$ldap_config = (array)$rcmail->config->get('ldap_public');
|
||||
$ldap_config = (array)self::$config->get('ldap_public');
|
||||
$config = $ldap_config[$config];
|
||||
}
|
||||
|
||||
|
@ -124,8 +125,8 @@ class kolab_storage
|
|||
}
|
||||
|
||||
// overwrite filter option
|
||||
if ($filter = $rcmail->config->get('kolab_users_filter')) {
|
||||
$rcmail->config->set('kolab_auth_filter', $filter);
|
||||
if ($filter = self::$config->get('kolab_users_filter')) {
|
||||
self::$config->set('kolab_auth_filter', $filter);
|
||||
}
|
||||
|
||||
// re-use the LDAP wrapper class from kolab_auth plugin
|
||||
|
@ -1328,12 +1329,12 @@ class kolab_storage
|
|||
return array();
|
||||
}
|
||||
|
||||
// FIXME: make search attributes configurable
|
||||
$results = self::$ldap->search(array('cn','mail','alias'), $query, $mode, $required, $limit);
|
||||
// search users using the configured attributes
|
||||
$results = self::$ldap->search(self::$config->get('kolab_users_search_attrib', array('cn','mail','alias')), $query, $mode, $required, $limit);
|
||||
|
||||
// resolve to IMAP folder name
|
||||
$root = self::namespace_root('other');
|
||||
$user_attrib = rcube::get_instance()->config->get('kolab_auth_login', 'mail');
|
||||
$user_attrib = self::$config->get('kolab_auth_login', 'mail');
|
||||
|
||||
array_walk($results, function(&$user, $dn) use ($root, $user_attrib) {
|
||||
list($localpart, $domain) = explode('@', $user[$user_attrib]);
|
||||
|
@ -1356,10 +1357,12 @@ class kolab_storage
|
|||
*/
|
||||
public static function list_user_folders($user, $type, $subscribed = null, &$folderdata = array())
|
||||
{
|
||||
self::setup();
|
||||
|
||||
$folders = array();
|
||||
|
||||
// use localpart of user attribute as root for folder listing
|
||||
$user_attrib = rcube::get_instance()->config->get('kolab_auth_login', 'mail');
|
||||
$user_attrib = self::$config->get('kolab_auth_login', 'mail');
|
||||
if (!empty($user[$user_attrib])) {
|
||||
list($mbox) = explode('@', $user[$user_attrib]);
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ abstract class kolab_storage_folder_api
|
|||
*/
|
||||
public function get_name()
|
||||
{
|
||||
return kolab_storage::object_name($this->name, $this->namespace);
|
||||
return kolab_storage::object_name($this->name, $this->get_namespace());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,8 +43,7 @@ class kolab_storage_folder_virtual extends kolab_storage_folder_api
|
|||
*/
|
||||
public function get_name()
|
||||
{
|
||||
// this is already kolab_storage::object_name() result
|
||||
return $this->displayname;
|
||||
return $this->displayname ?: parent::get_name();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue