plugins/kolab_auth

Aleksander Machniak machniak at kolabsys.com
Mon Oct 8 11:33:28 CEST 2012


 plugins/kolab_auth/config.inc.php.dist |    3 ++-
 plugins/kolab_auth/kolab_auth.php      |   16 +++++++++++-----
 plugins/kolab_auth/package.xml         |    2 +-
 3 files changed, 14 insertions(+), 7 deletions(-)

New commits:
commit bde912a1fe3fc9da2ab65a7ba0b3bb5a1f38d792
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Mon Oct 8 11:32:49 2012 +0200

    Create identity for each email address of a new user

diff --git a/plugins/kolab_auth/config.inc.php.dist b/plugins/kolab_auth/config.inc.php.dist
index 12f43e6..6ddfc63 100644
--- a/plugins/kolab_auth/config.inc.php.dist
+++ b/plugins/kolab_auth/config.inc.php.dist
@@ -11,8 +11,9 @@ $rcmail_config['kolab_auth_filter'] = '(&(objectClass=kolabInetOrgPerson)(|(uid=
 $rcmail_config['kolab_auth_login'] = 'email';
 
 // Use this fields (from fieldmap configuration) for default identity.
-// Note: These aren't LDAP attributes, but field names in config
 // If the value array contains more than one field, first non-empty will be used
+// Note: These aren't LDAP attributes, but field names in config
+// Note: If there's more than one email address, as many identities will be created
 $rcmail_config['kolab_auth_name']  = array('name', 'cn');
 $rcmail_config['kolab_auth_email'] = array('email');
 
diff --git a/plugins/kolab_auth/kolab_auth.php b/plugins/kolab_auth/kolab_auth.php
index c5d89ec..fb19e9e 100644
--- a/plugins/kolab_auth/kolab_auth.php
+++ b/plugins/kolab_auth/kolab_auth.php
@@ -206,8 +206,15 @@ class kolab_auth extends rcube_plugin
     public function user_create($args)
     {
         if (!empty($this->data['user_email'])) {
-            $args['user_email'] = $this->data['user_email'];
+            // addresses list is supported
+            if (array_key_exists('email_list', $args)) {
+                $args['email_list'] = array_unique($this->data['user_email']);
+            }
+            else {
+                $args['user_email'] = $this->data['user_email'][0];
+            }
         }
+
         if (!empty($this->data['user_name'])) {
             $args['user_name'] = $this->data['user_name'];
         }
@@ -374,12 +381,11 @@ class kolab_auth extends rcube_plugin
                 break;
             }
         }
-        // User email for identity (first log in)
+        // User email(s) for identity (first log in)
         foreach ((array)$email_attr as $field) {
-            $email = is_array($record[$field]) ? $record[$field][0] : $record[$field];
+            $email = is_array($record[$field]) ? array_filter($record[$field]) : $record[$field];
             if (!empty($email)) {
-                $this->data['user_email'] = $email;
-                break;
+                $this->data['user_email'] = array_merge((array)$this->data['user_email'], (array)$email);
             }
         }
 
diff --git a/plugins/kolab_auth/package.xml b/plugins/kolab_auth/package.xml
index abbd21f..6200c4c 100644
--- a/plugins/kolab_auth/package.xml
+++ b/plugins/kolab_auth/package.xml
@@ -20,7 +20,7 @@
 	</lead>
 	<date>2012-10-08</date>
 	<version>
-		<release>0.3</release>
+		<release>0.4</release>
 		<api>0.1</api>
 	</version>
 	<stability>





More information about the commits mailing list