Branch 'roundcubemail-plugins-kolab-3.1' - 3 commits - plugins/kolab_auth plugins/kolab_delegation
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Wed Sep 11 17:33:14 CEST 2013
plugins/kolab_auth/kolab_auth.php | 25 +++++++++++++++++++++++--
plugins/kolab_auth/kolab_auth_ldap.php | 4 +++-
plugins/kolab_delegation/kolab_delegation.php | 24 ++++++++++++++++++++++++
3 files changed, 50 insertions(+), 3 deletions(-)
New commits:
commit b4bf42b83fb4ad325437521770fbe20ebc67d7ef
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Wed Sep 11 14:07:50 2013 +0200
Take identities_level setting into consideration when identity form is going to be modified
diff --git a/plugins/kolab_auth/kolab_auth.php b/plugins/kolab_auth/kolab_auth.php
index 0b543b8..b8c5996 100644
--- a/plugins/kolab_auth/kolab_auth.php
+++ b/plugins/kolab_auth/kolab_auth.php
@@ -485,13 +485,20 @@ class kolab_auth extends rcube_plugin
*/
public function identity_form($args)
{
+ $rcmail = rcube::get_instance();
+ $ident_level = intval($rcmail->config->get('identities_level', 0));
+
+ // do nothing if email address modification is disabled
+ if ($ident_level == 1 || $ident_level == 3) {
+ return $args;
+ }
+
$ldap = self::ldap();
if (!$ldap || !$ldap->ready || empty($_SESSION['kolab_dn'])) {
return $args;
}
- $emails = array();
- $rcmail = rcube::get_instance();
+ $emails = array();
$user_record = $ldap->get_record($_SESSION['kolab_dn']);
foreach ((array)$rcmail->config->get('kolab_auth_email', array()) as $col) {
commit 3ce98406a3e6d84ab18629242e412c90478534b6
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Wed Sep 11 14:01:38 2013 +0200
Fix so kolab_delegation plugin can modify list of addresses in
identity form (Bug #2191)
diff --git a/plugins/kolab_auth/kolab_auth.php b/plugins/kolab_auth/kolab_auth.php
index 03aa453..0b543b8 100644
--- a/plugins/kolab_auth/kolab_auth.php
+++ b/plugins/kolab_auth/kolab_auth.php
@@ -500,6 +500,10 @@ class kolab_auth extends rcube_plugin
$emails = array_merge($emails, array_filter($values));
}
+ // kolab_delegation might want to modify this addresses list
+ $plugin = $rcmail->plugins->exec_hook('kolab_auth_emails', array('emails' => $emails));
+ $emails = $plugin['emails'];
+
if (!empty($emails)) {
$args['form']['addressing']['content']['email'] = array(
'type' => 'select',
diff --git a/plugins/kolab_auth/kolab_auth_ldap.php b/plugins/kolab_auth/kolab_auth_ldap.php
index 4584c60..2cddb3f 100644
--- a/plugins/kolab_auth/kolab_auth_ldap.php
+++ b/plugins/kolab_auth/kolab_auth_ldap.php
@@ -119,6 +119,7 @@ class kolab_auth_ldap extends rcube_ldap_generic
$entries = $result->entries(true);
$dn = key($entries);
$entry = array_pop($entries);
+ $entry = rcube_ldap_generic::normalize_entry($entry);
$entry = $this->field_mapping($dn, $entry);
return $entry;
@@ -287,7 +288,8 @@ class kolab_auth_ldap extends rcube_ldap_generic
if ($limit && $limit <= $i) {
break;
}
- $dn = $result->get_dn();
+ $dn = $result->get_dn();
+ $entry = rcube_ldap_generic::normalize_entry($entry);
$list[$dn] = $this->field_mapping($dn, $entry);
$i++;
}
diff --git a/plugins/kolab_delegation/kolab_delegation.php b/plugins/kolab_delegation/kolab_delegation.php
index 156e81f..23e0107 100644
--- a/plugins/kolab_delegation/kolab_delegation.php
+++ b/plugins/kolab_delegation/kolab_delegation.php
@@ -55,6 +55,9 @@ class kolab_delegation extends rcube_plugin
$this->add_hook('calendar_list_filter', array($this, 'calendar_list_filter'));
$this->add_hook('calendar_load_itip', array($this, 'calendar_load_itip'));
+ // delegation support in kolab_auth plugin
+ $this->add_hook('kolab_auth_emails', array($this, 'kolab_auth_emails'));
+
if ($this->rc->task == 'settings') {
// delegation management interface
$this->register_action('plugin.delegation', array($this, 'controller_ui'));
@@ -241,6 +244,27 @@ class kolab_delegation extends rcube_plugin
}
/**
+ * Delegation support in kolab_auth plugin
+ */
+ public function kolab_auth_emails($args)
+ {
+ // Add delegators addresses to address selector in user identity form
+
+ if (!empty($_SESSION['delegators'])) {
+ // @TODO: Consider not adding all delegator addresses to the list.
+ // Instead add only address of currently edited identity
+ foreach ($_SESSION['delegators'] as $emails) {
+ $args['emails'] = array_merge($args['emails'], $emails);
+ }
+
+ $args['emails'] = array_unique($args['emails']);
+ sort($args['emails']);
+ }
+
+ return $args;
+ }
+
+ /**
* Delegation UI handler
*/
public function controller_ui()
commit e93a3c67d2cc4258797a5c94db75944e140e50c5
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Wed Sep 11 16:31:19 2013 +0100
Add the possibility to set the a mailhost attribute value to be used as the IMAP server address to connect to.
diff --git a/plugins/kolab_auth/kolab_auth.php b/plugins/kolab_auth/kolab_auth.php
index e6171d2..03aa453 100644
--- a/plugins/kolab_auth/kolab_auth.php
+++ b/plugins/kolab_auth/kolab_auth.php
@@ -326,11 +326,21 @@ class kolab_auth extends rcube_plugin
$email_attr = $rcmail->config->get('kolab_auth_email');
$org_attr = $rcmail->config->get('kolab_auth_organization');
$role_attr = $rcmail->config->get('kolab_auth_role');
+ $imap_attr = $rcmail->config->get('kolab_auth_mailhost');
if (!empty($role_attr) && !empty($record[$role_attr])) {
$_SESSION['user_roledns'] = (array)($record[$role_attr]);
}
+ if (!empty($imap_attr) && !empty($record[$role_attr])) {
+ $default_host = $rcmail->config->get('default_host');
+ if (!empty($default_host)) {
+ rcube::write_log("errors", "Both default host and kolab_auth_mailhost set. Incompatible.");
+ } else {
+ $args['host'] = "tls://" . $record[$role_attr];
+ }
+ }
+
// Login As...
if (!empty($loginas) && $admin_login) {
// Authenticate to LDAP
More information about the commits
mailing list