Allow to configure the name (inlcude OU) displayed for virtual user folders (#3384)
This commit is contained in:
parent
0d9e422811
commit
824db716b4
6 changed files with 33 additions and 4 deletions
|
@ -74,7 +74,7 @@ class kolab_user_calendar extends kolab_calendar
|
||||||
*/
|
*/
|
||||||
public function get_name()
|
public function get_name()
|
||||||
{
|
{
|
||||||
return $this->userdata['name'] ?: $this->userdata['mail'];
|
return $this->userdata['displayname'] ?: ($this->userdata['name'] ?: $this->userdata['mail']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ class kolab_user_calendar extends kolab_calendar
|
||||||
*/
|
*/
|
||||||
public function get_title()
|
public function get_title()
|
||||||
{
|
{
|
||||||
return $this->userdata['mail'];
|
return trim($this->userdata['displayname'] . '; ' . $this->userdata['mail'], '; ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,10 @@ $rcmail_config['kolab_auth_name'] = array('name', 'cn');
|
||||||
$rcmail_config['kolab_auth_email'] = array('email');
|
$rcmail_config['kolab_auth_email'] = array('email');
|
||||||
$rcmail_config['kolab_auth_organization'] = array('organization');
|
$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.
|
// Login and password of the admin user. Enables "Login As" feature.
|
||||||
$rcmail_config['kolab_auth_admin_login'] = '';
|
$rcmail_config['kolab_auth_admin_login'] = '';
|
||||||
$rcmail_config['kolab_auth_admin_password'] = '';
|
$rcmail_config['kolab_auth_admin_password'] = '';
|
||||||
|
|
|
@ -28,12 +28,17 @@
|
||||||
class kolab_auth_ldap extends rcube_ldap_generic
|
class kolab_auth_ldap extends rcube_ldap_generic
|
||||||
{
|
{
|
||||||
private $icache = array();
|
private $icache = array();
|
||||||
|
private $conf = array();
|
||||||
|
private $fieldmap = array();
|
||||||
|
|
||||||
|
|
||||||
function __construct($p)
|
function __construct($p)
|
||||||
{
|
{
|
||||||
$rcmail = rcube::get_instance();
|
$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 = $p['fieldmap'];
|
||||||
$this->fieldmap['uid'] = 'uid';
|
$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;
|
return $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ class kolab_notes extends rcube_plugin
|
||||||
'id' => $list_id,
|
'id' => $list_id,
|
||||||
'name' => $fullname,
|
'name' => $fullname,
|
||||||
'listname' => $listname,
|
'listname' => $listname,
|
||||||
'title' => $folder->get_owner(),
|
'title' => $folder->get_title(),
|
||||||
'virtual' => true,
|
'virtual' => true,
|
||||||
'editable' => false,
|
'editable' => false,
|
||||||
'group' => 'other virtual',
|
'group' => 'other virtual',
|
||||||
|
|
|
@ -64,6 +64,16 @@ class kolab_storage_folder_user extends kolab_storage_folder_virtual
|
||||||
parent::get_foldername();
|
parent::get_foldername();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for a more informative title of this user folder
|
||||||
|
*
|
||||||
|
* @return string Title for the given user record
|
||||||
|
*/
|
||||||
|
public function get_title()
|
||||||
|
{
|
||||||
|
return trim($this->ldaprec['displayname'] . '; ' . $this->ldaprec['mail'], '; ');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the owner of the folder.
|
* Returns the owner of the folder.
|
||||||
*
|
*
|
||||||
|
|
|
@ -199,7 +199,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
||||||
'id' => $list_id,
|
'id' => $list_id,
|
||||||
'name' => $folder->get_name(),
|
'name' => $folder->get_name(),
|
||||||
'listname' => $listname,
|
'listname' => $listname,
|
||||||
'title' => $folder->get_owner(),
|
'title' => $folder->get_title(),
|
||||||
'virtual' => true,
|
'virtual' => true,
|
||||||
'editable' => false,
|
'editable' => false,
|
||||||
'group' => 'other virtual',
|
'group' => 'other virtual',
|
||||||
|
|
Loading…
Add table
Reference in a new issue