summaryrefslogtreecommitdiff
path: root/plugins/kolab_auth
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-08-18 11:34:10 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-08-18 11:34:20 (GMT)
commit824db716b4b6f08ca649d5a2a88a77c87f062e10 (patch)
tree21851231e792671946166311ffe45005ce50e832 /plugins/kolab_auth
parent0d9e4228111341deb78c26e0b3e9a7d592083dac (diff)
downloadroundcubemail-plugins-kolab-824db716b4b6f08ca649d5a2a88a77c87f062e10.tar.gz
Allow to configure the name (inlcude OU) displayed for virtual user folders (#3384)
Diffstat (limited to 'plugins/kolab_auth')
-rw-r--r--plugins/kolab_auth/config.inc.php.dist4
-rw-r--r--plugins/kolab_auth/kolab_auth_ldap.php15
2 files changed, 19 insertions, 0 deletions
diff --git a/plugins/kolab_auth/config.inc.php.dist b/plugins/kolab_auth/config.inc.php.dist
index 7a23301..785fb78 100644
--- a/plugins/kolab_auth/config.inc.php.dist
+++ b/plugins/kolab_auth/config.inc.php.dist
@@ -29,6 +29,10 @@ $rcmail_config['kolab_auth_name'] = array('name', 'cn');
$rcmail_config['kolab_auth_email'] = array('email');
$rcmail_config['kolab_auth_organization'] = array('organization');
+// Template for user names displayed in the UI.
+// You can use all attributes from the 'fieldmap' property of the 'kolab_auth_addressbook' configuration
+$rcmail_config['kolab_auth_user_displayname'] = '{name} ({ou})';
+
// Login and password of the admin user. Enables "Login As" feature.
$rcmail_config['kolab_auth_admin_login'] = '';
$rcmail_config['kolab_auth_admin_password'] = '';
diff --git a/plugins/kolab_auth/kolab_auth_ldap.php b/plugins/kolab_auth/kolab_auth_ldap.php
index 0e3f238..117db8c 100644
--- a/plugins/kolab_auth/kolab_auth_ldap.php
+++ b/plugins/kolab_auth/kolab_auth_ldap.php
@@ -28,12 +28,17 @@
class kolab_auth_ldap extends rcube_ldap_generic
{
private $icache = array();
+ private $conf = array();
+ private $fieldmap = array();
function __construct($p)
{
$rcmail = rcube::get_instance();
+ $this->conf = $p;
+ $this->conf['kolab_auth_user_displayname'] = $rcmail->config->get('kolab_auth_user_displayname', '{name}');
+
$this->fieldmap = $p['fieldmap'];
$this->fieldmap['uid'] = 'uid';
@@ -340,6 +345,16 @@ class kolab_auth_ldap extends rcube_ldap_generic
}
}
+ // compose display name according to config
+ if (empty($this->fieldmap['displayname'])) {
+ $entry['displayname'] = rcube_addressbook::compose_search_name(
+ $entry,
+ $entry['email'],
+ $entry['name'],
+ $this->conf['kolab_auth_user_displayname']
+ );
+ }
+
return $entry;
}