5 commits - pykolab/auth pykolab/imap share/templates

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Sun Aug 5 21:25:25 CEST 2012


 pykolab/auth/ldap/__init__.py                   |   32 ++++++++++++
 pykolab/imap/__init__.py                        |   62 +++++++++++++++++++++++-
 share/templates/roundcubemail/kolab.inc.php.tpl |   14 +----
 share/templates/roundcubemail/main.inc.php.tpl  |    3 -
 4 files changed, 96 insertions(+), 15 deletions(-)

New commits:
commit 05ebbb486e1f511d0003614e2e9b8682c49a64c7
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Sun Aug 5 20:12:11 2012 +0100

    Make sure new users are subscribed to all folders in the personal namespace (#922)

diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 25ec560..e5344c7 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -212,6 +212,42 @@ class IMAP(object):
         else:
             raise AttributeError, _("%r has no attribute %s") % (self,name)
 
+    def namespaces(self):
+        """
+            Obtain the namespaces.
+
+            Returns a tuple of:
+
+                (str(personal) [, str(other users) [, list(shared)]])
+        """
+
+        _personal = None
+        _other_users = None
+        _shared = None
+
+        (_response, _namespaces) = self.imap.m.namespace()
+
+        if len(_namespaces) == 1:
+            _namespaces = _namespaces[0]
+
+        _namespaces = re.split(r"\)\)\s\(\(", _namespaces)
+
+        _other_users = [
+                ''.join(_namespaces[1].replace('((','').replace('))','').split()[-1])
+            ]
+
+        if len(_namespaces) >= 3:
+            _shared = []
+            _shared.append(' '.join(_namespaces[2].replace('((','').replace('))','').split()[:-1]))
+
+        if len(_namespaces) >= 2:
+            _other_users = ' '.join(_namespaces[1].replace('((','').replace('))','').split()[:-1])
+
+        if len(_namespaces) >= 1:
+            _personal = _namespaces[0].replace('((','').replace('))','').split()[0]
+
+        return (_personal, _other_users, _shared)
+
     def shared_folder_create(self, folder_path, server=None):
         """
             Create a shared folder.
@@ -384,8 +420,30 @@ class IMAP(object):
         self.connect(login=False)
         self.login_plain(admin_login, admin_password, folder)
 
-        for _folder in self.lm("%s/*%s" % (folder_name.split('@')[0],domain_suffix)):
-            self.subscribe(_folder)
+        _tests = []
+
+        # Subscribe only to personal folders
+        (personal, other, shared) = self.namespaces()
+
+        if not other == None:
+            _tests.append(other)
+
+        if not shared == None:
+            for _shared in shared:
+                _tests.append(_shared)
+
+        for _folder in self.lm():
+            _subscribe = True
+
+            for _test in _tests:
+                if not _subscribe:
+                    continue
+
+                if _folder.startswith(_test):
+                    _subscribe = False
+
+            if _subscribe:
+                self.subscribe(_folder)
 
         self.logout()
 


commit 56a8ba9d57ff9432ec4b3299e8a7c18adcec6dad
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Sun Aug 5 20:06:58 2012 +0100

    Add mailalternateaddress as personal by default

diff --git a/share/templates/roundcubemail/main.inc.php.tpl b/share/templates/roundcubemail/main.inc.php.tpl
index 9ea218b..78f1434 100644
--- a/share/templates/roundcubemail/main.inc.php.tpl
+++ b/share/templates/roundcubemail/main.inc.php.tpl
@@ -236,6 +236,7 @@
                             'prefix'            => 'title',
                             'email:primary'     => 'mail',
                             'email:alias'       => 'alias',
+                            'email:personal'    => 'mailalternateaddress',
                             'phone:main'        => 'telephoneNumber',
                             'phone:work'        => 'alternateTelephoneNumber',
                             'phone:mobile'      => 'mobile',


commit fe81dba2c91258be66829fb6d0a488781ec03c69
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Sun Aug 5 15:33:50 2012 +0100

    Prevent a singular alias (a basestring thanks to normalization) from being compared to a list, causing an endless modification loop for corner-case LDAP entries (#934)

diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 8d82d6a..8c5a8e4 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -704,15 +704,44 @@ class LDAP(pykolab.base.Base):
             log.debug(_("Recipient policy composed the following set of secondary " + \
                     "email addresses: %r") % (secondary_mail_addresses), level=8)
 
+
             if not secondary_mail_addresses == None:
+                log.debug(
+                        _("Secondary mail addresses that we want is not None: %r") % (
+                                secondary_mail_addresses
+                            ),
+                        level=9
+                    )
+
                 secondary_mail_addresses = list(set(secondary_mail_addresses))
+
                 # Avoid duplicates
                 while primary_mail_address in secondary_mail_addresses:
+                    log.debug(
+                            _("Avoiding the duplication of the primary mail " + \
+                                    "address %r in the list of secondary mail " + \
+                                    "addresses") % (primary_mail_address),
+                            level=9
+                        )
+
                     secondary_mail_addresses.pop(
                             secondary_mail_addresses.index(primary_mail_address)
                         )
 
+                log.debug(
+                        _("Entry is getting secondary mail addresses: %r") % (
+                                secondary_mail_addresses
+                            ),
+                        level=9
+                    )
+
                 if not entry.has_key(secondary_mail_attribute):
+                    log.debug(
+                            _("Entry did not have any secondary mail " + \
+                                    "addresses in %r") % (secondary_mail_attribute),
+                            level=9
+                        )
+
                     if not len(secondary_mail_addresses) == 0:
                         self.set_entry_attribute(
                                 entry,
@@ -722,6 +751,9 @@ class LDAP(pykolab.base.Base):
 
                         entry_modifications[secondary_mail_attribute] = secondary_mail_addresses
                 else:
+                    if isinstance(entry[secondary_mail_attribute], basestring):
+                        entry[secondary_mail_attribute] = list(set([entry[secondary_mail_attribute]]))
+
                     if not secondary_mail_addresses == entry[secondary_mail_attribute]:
                         self.set_entry_attribute(
                                 entry,


commit 3a2e0311e539e0a3e51128cd4a93301bd8955823
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Sun Aug 5 13:17:11 2012 +0100

    Expire the use of the kolab_core plugin

diff --git a/share/templates/roundcubemail/main.inc.php.tpl b/share/templates/roundcubemail/main.inc.php.tpl
index e0497cb..9ea218b 100644
--- a/share/templates/roundcubemail/main.inc.php.tpl
+++ b/share/templates/roundcubemail/main.inc.php.tpl
@@ -96,7 +96,6 @@
             'kolab_activesync',
             'kolab_addressbook',
             'kolab_auth',
-            'kolab_core',
             'kolab_config',
             'kolab_folders',
             'listcommands',
@@ -181,7 +180,6 @@
             'calendar',
             'kolab_addressbook',
             'kolab_auth',
-            'kolab_core',
             'kolab_config',
             'kolab_folders',
             'password',


commit 457aa3bb42b7ea80f2525272b63b13e133049d0b
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Sun Aug 5 13:16:09 2012 +0100

    Remove obsolete settings and add new settings from kolab.inc.php

diff --git a/share/templates/roundcubemail/kolab.inc.php.tpl b/share/templates/roundcubemail/kolab.inc.php.tpl
index 124b26e..b0801d8 100644
--- a/share/templates/roundcubemail/kolab.inc.php.tpl
+++ b/share/templates/roundcubemail/kolab.inc.php.tpl
@@ -1,17 +1,9 @@
 <?php
-// Configuration for Kolab LDAP binding used by Kolab_Storage
-\$rcmail_config['kolab']['ldap']['server'] = '$ldap_ldap_uri';
-\$rcmail_config['kolab']['ldap']['basedn'] = '$ldap_base_dn';
-\$rcmail_config['kolab']['ldap']['phpdn'] = '$ldap_service_bind_dn';
-\$rcmail_config['kolab']['ldap']['phppw'] = '$ldap_service_bind_pw';
 
 \$rcmail_config['kolab_freebusy_server'] = 'http://' . \$_SERVER["HTTP_HOST"] . '/freebusy';
 
-\$rcmail_config['kolab']['imap']['secure'] = true;
-\$rcmail_config['kolab']['imap']['namespaces'] = array(
-    array('type' => 'personal', 'name' => '', 'delimiter' => '/'),
-    array('type' => 'other', 'name' => 'Other Users', 'delimiter' => '/'),
-    array('type' => 'shared', 'name' => 'Shared Folders', 'delimiter' => '/'),
-);
+\$rcmail_config['kolab_cache'] = true;
+
+\$rcmail_config['kolab_ssl_verify_peer'] = false;
 
 ?>





More information about the commits mailing list