plugins/kolab_auth
Thomas Brüderli
bruederli at kolabsys.com
Thu Sep 5 10:13:37 CEST 2013
plugins/kolab_auth/kolab_auth.php | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
New commits:
commit 74f1d3ba854f1d870ce11a552fde2b4fd057b252
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Thu Sep 5 10:13:21 2013 +0200
Hook into identities form and present a list of allowed sender email addresses (#2191)
diff --git a/plugins/kolab_auth/kolab_auth.php b/plugins/kolab_auth/kolab_auth.php
index b139e32..e6171d2 100644
--- a/plugins/kolab_auth/kolab_auth.php
+++ b/plugins/kolab_auth/kolab_auth.php
@@ -46,6 +46,7 @@ class kolab_auth extends rcube_plugin
$this->add_hook('storage_connect', array($this, 'imap_connect'));
$this->add_hook('managesieve_connect', array($this, 'imap_connect'));
$this->add_hook('smtp_connect', array($this, 'smtp_connect'));
+ $this->add_hook('identity_form', array($this, 'identity_form'));
$this->add_hook('write_log', array($this, 'write_log'));
@@ -469,6 +470,37 @@ class kolab_auth extends rcube_plugin
}
/**
+ * Hook to replace the plain text input field for email address by a drop-down list
+ * with all email addresses (including aliases) from this user's LDAP record.
+ */
+ public function identity_form($args)
+ {
+ $ldap = self::ldap();
+ if (!$ldap || !$ldap->ready || empty($_SESSION['kolab_dn'])) {
+ return $args;
+ }
+
+ $emails = array();
+ $rcmail = rcube::get_instance();
+ $user_record = $ldap->get_record($_SESSION['kolab_dn']);
+
+ foreach ((array)$rcmail->config->get('kolab_auth_email', array()) as $col) {
+ $values = rcube_addressbook::get_col_values($col, $user_record, true);
+ if (!empty($values))
+ $emails = array_merge($emails, array_filter($values));
+ }
+
+ if (!empty($emails)) {
+ $args['form']['addressing']['content']['email'] = array(
+ 'type' => 'select',
+ 'options' => array_combine($emails, $emails),
+ );
+ }
+
+ return $args;
+ }
+
+ /**
* Initializes LDAP object and connects to LDAP server
*/
public static function ldap()
More information about the commits
mailing list