Branch 'pykolab-0.5' - 6 commits - pykolab/auth pykolab/cli pykolab/imap pykolab/setup share/templates share/tests

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Fri Sep 7 14:15:10 CEST 2012


 pykolab/auth/ldap/__init__.py                                 |    5 
 pykolab/cli/cmd_list_quota.py                                 |   14 
 pykolab/imap/__init__.py                                      |   28 
 pykolab/setup/setup_roundcube.py                              |    1 
 share/templates/roundcubemail/acl.inc.php.tpl                 |    5 
 share/templates/roundcubemail/calendar.inc.php.tpl            |    5 
 share/templates/roundcubemail/compose_addressbook.inc.php.tpl |    4 
 share/templates/roundcubemail/db.inc.php.tpl                  |    4 
 share/templates/roundcubemail/kolab.inc.php.tpl               |   18 
 share/templates/roundcubemail/kolab_auth.inc.php.tpl          |  110 +--
 share/templates/roundcubemail/kolab_folders.inc.php.tpl       |    5 
 share/templates/roundcubemail/main.inc.php.tpl                |   11 
 share/templates/roundcubemail/managesieve.inc.php.tpl         |    5 
 share/templates/roundcubemail/owncloud.inc.php.tpl            |    7 
 share/templates/roundcubemail/password.inc.php.tpl            |  298 +++++-----
 share/templates/roundcubemail/terms.inc.php.tpl               |   24 
 share/tests/kaddress-contact.tpl                              |   54 -
 share/tests/kcal-event.tpl                                    |   67 --
 18 files changed, 295 insertions(+), 370 deletions(-)

New commits:
commit c52d414f8756a405fd98df58f7ca2abc040a5fe1
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Sep 7 13:12:42 2012 +0100

    Make sure quota changes propagate from LDAP to IMAP

diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 18ac294..67657f5 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -858,7 +858,6 @@ class LDAP(pykolab.base.Base):
             )
 
     def user_quota(self, entry_id, folder):
-
         default_quota = self.config_get('default_quota')
         quota_attribute = self.config_get('quota_attribute')
 
@@ -874,6 +873,7 @@ class LDAP(pykolab.base.Base):
 
         current_ldap_quota = self.get_entry_attribute(entry_dn, quota_attribute)
         _imap_quota = self.imap.get_quota(folder)
+
         if _imap_quota == None:
             used = None
             current_imap_quota = None
@@ -1078,6 +1078,7 @@ class LDAP(pykolab.base.Base):
                     entry[result_attribute],
                     entry[mailserver_attribute]
                 )
+
         else:
             folder = "user%s%s" % (self.imap.separator,entry[result_attribute])
 
@@ -1258,6 +1259,8 @@ class LDAP(pykolab.base.Base):
 
                 conf.changelog[entry['id']] = entry_changes[result_attribute]
 
+        self.user_quota(entry, "user%s%s" % (self.imap.separator,entry[result_attribute]))
+
     def _change_none_group(self, entry, change):
         """
             A group entry as part of the initial search result set.
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index c6e3889..391714d 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -416,9 +416,11 @@ class IMAP(object):
                         )
 
         if len(folder.split('@')) > 1:
+            localpart = folder.split('@')[0]
             domain = folder.split('@')[1]
             domain_suffix = "@%s" % (domain)
         else:
+            localpart = folder
             domain = None
             domain_suffix = ""
 
@@ -465,7 +467,14 @@ class IMAP(object):
         self.connect(domain=self.domain)
 
         for additional_folder in additional_folders.keys():
-            folder_name = additional_folder
+            folder_name = "user%s%s%s%s%s" % (
+                    self.imap.separator,
+                    localpart,
+                    self.imap.separator,
+                    additional_folder,
+                    domain_suffix
+                )
+
             if additional_folders[additional_folder].has_key("quota"):
                 self.imap.sq(
                         folder_name,


commit b241933e98c81fde65b2af9d0e873e00dea7b75d
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Sep 7 12:46:32 2012 +0100

    Remove these test templates

diff --git a/share/tests/kaddress-contact.tpl b/share/tests/kaddress-contact.tpl
deleted file mode 100644
index 1aefcc8..0000000
--- a/share/tests/kaddress-contact.tpl
+++ /dev/null
@@ -1,54 +0,0 @@
-From: %(from_name_str)s <%(from_email_str)s>
-To: %(to_name_str)s <%(to_email_str)s>
-Subject: %(uid)s
-Date: %(rfc_2822_sent_date)s
-MIME-Version: 1.0
-X-Kolab-Type: application/x-vnd.kolab.contact
-Content-Type: Multipart/Mixed;
-  boundary="Boundary-00=%(uid)s"
-
---Boundary-00=%(uid)s
-Content-Type: Text/Plain;
-  charset="us-ascii"
-Content-Transfer-Encoding: 7bit
-Content-Disposition:
-
-This is a Kolab Groupware object.
-To view this object you will need an email client that can understand the Kolab Groupware format.
-For a list of such email clients please visit
-http://www.kolab.org/kolab2-clients.html
-
---Boundary-00=%(uid)s
-Content-Type: application/x-vnd.kolab.contact;
-  name="kolab.xml"
-Content-Transfer-Encoding: 7bit
-Content-Disposition: attachment;
-  filename="kolab.xml"
-
-<?xml version="1.0" encoding="UTF-8"?>
-<contact version="1.0">
- <product-id>KAddressBook 3.3, Kolab resource</product-id>
- <uid>%(uid)s</uid>
- <body>body</body>
- <creation-date>%(kolab_creation_date)s</creation-date>
- <sensitivity>public</sensitivity>
- <name>
-  <given-name>%(kolab_contact_given_name)s</given-name>
-  <last-name>%(kolab_contact_last_name)s</last-name>
-  <full-name>%(kolab_contact_given_name)s %(kolab_contact_last_name)s</full-name>
- </name>
- <organization></organization>
- <web-page></web-page>
- <role></role>
- <email>
-   <display-name>%(kolab_contact_given_name)s %(kolab_contact_last_name)s</display-name>
-   <smtp-address>%(kolab_contact_email_str)s</smtp-address>
- </email>
- <phone>
-    <type>mobile</type>
-    <number>%(kolab_contact_mobile_number)s</number>
- </phone>
- <preferred-address></preferred-address>
-</contact>
-
---Boundary-00=%(uid)s--
diff --git a/share/tests/kcal-event.tpl b/share/tests/kcal-event.tpl
deleted file mode 100644
index 2c9dc2c..0000000
--- a/share/tests/kcal-event.tpl
+++ /dev/null
@@ -1,67 +0,0 @@
-From: %(from_name_str)s <%(from_email_str)s>
-To: %(to_name_str)s <%(to_email_str)s>
-Subject: libkcal-%(uid)s
-Date: %(rfc_2822_sent_date)s
-MIME-Version: 1.0
-X-Kolab-Type: application/x-vnd.kolab.event
-Content-Type: Multipart/Mixed;
-  boundary="Boundary-00=%(uid)s"
-Status: RO
-X-Status: OT
-X-KMail-EncryptionState:
-X-KMail-SignatureState:
-X-KMail-MDN-Sent:
-X-UID: 0
-
---Boundary-00=%(uid)s
-Content-Type: Text/Plain;
-  charset="us-ascii"
-Content-Transfer-Encoding: 7bit
-Content-Disposition:
-
-This is a Kolab Groupware object.
-To view this object you will need an email client that can understand the Kolab Groupware format.
-For a list of such email clients please visit
-http://www.kolab.org/kolab2-clients.html
---Boundary-00=%(uid)s
-Content-Type: application/x-vnd.kolab.event;
-  name="kolab.xml"
-Content-Transfer-Encoding: 7bit
-Content-Disposition: attachment;
-  filename="kolab.xml"
-
-<?xml version="1.0" encoding="UTF-8"?>
-<event version="1.0">
- <product-id>KOrganizer 4.4.5, Kolab resource</product-id>
- <uid>libkcal-%(uid)s</uid>
- <creation-date>%(kolab_event_date_creation)s</creation-date>
- <last-modification-date>2010-10-21T13:42:14+00:00</last-modification-date>
- <sensitivity>public</sensitivity>
- <start-date>%(kolab_event_date_start)s</start-date>
- <summary>%(event_summary)s</summary>
- <location>%(event_location)s</location>
- <organizer>
-  <display-name>%(from_name_str)s</display-name>
-  <smtp-address>%(from_email_str)s</smtp-address>
- </organizer>
- <attendee>
-  <display-name>%(to_name_str)s</display-name>
-  <smtp-address>%(to_email_str)s</smtp-address>
-  <status>accepted</status>
-  <request-response>false</request-response>
-  <invitation-sent>false</invitation-sent>
-  <role>required</role>
- </attendee>%(event_recurrence)s
- <alarm>15</alarm>
- <advanced-alarms>
-  <alarm type="display">
-   <enabled>1</enabled>
-   <start-offset>-15</start-offset>
-  </alarm>
- </advanced-alarms>
- <revision>0</revision>
- <show-time-as>busy</show-time-as>
- <end-date>%(kolab_event_date_end)s</end-date>
-</event>
-
---Boundary-00=%(uid)s--


commit 0011c58cb6d3171912ce2b97b40f0e1285898371
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Sep 7 12:46:08 2012 +0100

    Clause cmd_list_quota to accept there may be no quota at all

diff --git a/pykolab/cli/cmd_list_quota.py b/pykolab/cli/cmd_list_quota.py
index d71f272..dfd8b75 100644
--- a/pykolab/cli/cmd_list_quota.py
+++ b/pykolab/cli/cmd_list_quota.py
@@ -54,11 +54,17 @@ def execute(*args, **kw):
     for quota_folder in quota_folders:
         try:
             (used, quota) = imap.get_quota(quota_folder)
-            percentage = round((used/quota)*100, 1)
-            print "%d (Used: %d, Percentage: %d)" % (quota, used, percentage)
+            if not used == None and not quota == None:
+                percentage = round((used/quota)*100, 1)
+                print "%d (Used: %d, Percentage: %d)" % (quota, used, percentage)
+            else:
+                print "No quota"
         except:
             (quota_root, used, quota) = imap.get_quota_root(quota_folder)
-            percentage = round((used/quota)*100, 1)
-            print "%d (Root: %s, Used: %d, Percentage: %d)" % (quota, quota_root, used, percentage)
+            if not quota_root == None and not used == None and not quota == None:
+                percentage = round((used/quota)*100, 1)
+                print "%d (Root: %s, Used: %d, Percentage: %d)" % (quota, quota_root, used, percentage)
+            else:
+                print "No quota"
 
 


commit 729ef57b9d88fa8dd576c2dead454b2097ab5f13
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Sep 7 12:45:30 2012 +0100

    Remove compose_addressbook from template files to compile and include

diff --git a/pykolab/setup/setup_roundcube.py b/pykolab/setup/setup_roundcube.py
index 8a720bf..0f45711 100644
--- a/pykolab/setup/setup_roundcube.py
+++ b/pykolab/setup/setup_roundcube.py
@@ -89,7 +89,6 @@ def execute(*args, **kw):
     want_files = [
             'acl.inc.php',
             'calendar.inc.php',
-            'compose_addressbook.inc.php',
             'db.inc.php',
             'kolab_auth.inc.php',
             'kolab_folders.inc.php',


commit dfb7f341a65de9c8cfce925484ac7a7b755598e4
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Sep 7 12:44:29 2012 +0100

    Include $_SERVER["HTTP_HOST"] specific configuration if it is available.
    
    Conflicts:
    	share/templates/roundcubemail/kolab.inc.php.tpl

diff --git a/share/templates/roundcubemail/acl.inc.php.tpl b/share/templates/roundcubemail/acl.inc.php.tpl
index 0e26cd2..12cdc51 100644
--- a/share/templates/roundcubemail/acl.inc.php.tpl
+++ b/share/templates/roundcubemail/acl.inc.php.tpl
@@ -3,4 +3,9 @@
     \$rcmail_config['acl_users_source'] = 'kolab_addressbook';
     \$rcmail_config['acl_users_field'] = 'mail';
     \$rcmail_config['acl_users_filter'] = 'objectClass=kolabInetOrgPerson';
+
+    if (file_exists(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__)) {
+        include_once(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__));
+    }
+
 ?>
diff --git a/share/templates/roundcubemail/calendar.inc.php.tpl b/share/templates/roundcubemail/calendar.inc.php.tpl
index bc871ce..b7b668f 100644
--- a/share/templates/roundcubemail/calendar.inc.php.tpl
+++ b/share/templates/roundcubemail/calendar.inc.php.tpl
@@ -7,4 +7,9 @@
     \$rcmail_config['calendar_work_start'] = 6;
     \$rcmail_config['calendar_work_end'] = 18;
     \$rcmail_config['calendar_event_coloring'] = 0;
+
+    if (file_exists(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__)) {
+        include_once(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__));
+    }
+
 ?>
diff --git a/share/templates/roundcubemail/compose_addressbook.inc.php.tpl b/share/templates/roundcubemail/compose_addressbook.inc.php.tpl
deleted file mode 100644
index 31702ac..0000000
--- a/share/templates/roundcubemail/compose_addressbook.inc.php.tpl
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-    \$rcmail_config['compose_addressbooks'] = \$rcmail_config['autocomplete_addressbooks'];
-    \$rcmail_config['compose_addressbook_mode'] = 'full';
-?>
diff --git a/share/templates/roundcubemail/db.inc.php.tpl b/share/templates/roundcubemail/db.inc.php.tpl
index 8b8db48..caec957 100644
--- a/share/templates/roundcubemail/db.inc.php.tpl
+++ b/share/templates/roundcubemail/db.inc.php.tpl
@@ -4,6 +4,10 @@
 
     \$rcmail_config['db_dsnw'] = '$mysql_uri';
 
+    if (file_exists(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__)) {
+        include_once(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__));
+    }
+
     \$rcmail_config['db_max_length'] = 512000;
     \$rcmail_config['db_persistent'] = TRUE;
     \$rcmail_config['db_table_users'] = 'users';
diff --git a/share/templates/roundcubemail/kolab.inc.php.tpl b/share/templates/roundcubemail/kolab.inc.php.tpl
index 124b26e..b97fa2b 100644
--- a/share/templates/roundcubemail/kolab.inc.php.tpl
+++ b/share/templates/roundcubemail/kolab.inc.php.tpl
@@ -1,17 +1,11 @@
 <?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_freebusy_server'] = 'http://' . \$_SERVER["HTTP_HOST"] . '/freebusy';
+    if (file_exists(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__)) {
+        include_once(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__));
+    }
 
-\$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;
 ?>
diff --git a/share/templates/roundcubemail/kolab_auth.inc.php.tpl b/share/templates/roundcubemail/kolab_auth.inc.php.tpl
index 41e0bc8..5568c0a 100644
--- a/share/templates/roundcubemail/kolab_auth.inc.php.tpl
+++ b/share/templates/roundcubemail/kolab_auth.inc.php.tpl
@@ -1,66 +1,70 @@
 <?php
 
-// The id of the LDAP address book (which refers to the rcmail_config['ldap_public'])
-// or complete addressbook definition array.
-\$rcmail_config['kolab_auth_addressbook'] = Array(
-    'name'                      => 'Kolab Auth',
-    'hosts'                     => Array('localhost'),
-    'port'                      => 389,
-    'use_tls'                   => false,
-    'user_specific'             => false,
-    'base_dn'                   => '$ldap_user_base_dn',
-    'bind_dn'                   => '$ldap_service_bind_dn',
-    'bind_pass'                 => '$ldap_service_bind_pw',
-    'writable'                  => false,
-    'ldap_version'              => 3,       // using LDAPv3
-    'fieldmap'                  => Array(
-            'name'              => 'displayname',
-            'email'             => 'mail',
-            'email:alias'       => 'alias',
-            'role'              => 'nsroledn',
-        ),
-    'sort'                      => 'displayname',
-    'scope'                     => 'sub',
-    'filter'                    => '(objectClass=*)',
-    'fuzzy_search'              => true,
-    'sizelimit'                 => '0',
-    'timelimit'                 => '0',
-    'groups'                    => Array(
-            'base_dn'           => '$ldap_group_base_dn',
-            'filter'            => '$ldap_group_filter',
-            'object_classes'    => Array('top', 'groupOfUniqueNames'),
-            'member_attr'       => 'uniqueMember',
-        ),
-);
+    // The id of the LDAP address book (which refers to the rcmail_config['ldap_public'])
+    // or complete addressbook definition array.
+    \$rcmail_config['kolab_auth_addressbook'] = Array(
+        'name'                      => 'Kolab Auth',
+        'hosts'                     => Array('localhost'),
+        'port'                      => 389,
+        'use_tls'                   => false,
+        'user_specific'             => false,
+        'base_dn'                   => '$ldap_user_base_dn',
+        'bind_dn'                   => '$ldap_service_bind_dn',
+        'bind_pass'                 => '$ldap_service_bind_pw',
+        'writable'                  => false,
+        'ldap_version'              => 3,       // using LDAPv3
+        'fieldmap'                  => Array(
+                'name'              => 'displayname',
+                'email'             => 'mail',
+                'email:alias'       => 'alias',
+                'role'              => 'nsroledn',
+            ),
+        'sort'                      => 'displayname',
+        'scope'                     => 'sub',
+        'filter'                    => '(objectClass=*)',
+        'fuzzy_search'              => true,
+        'sizelimit'                 => '0',
+        'timelimit'                 => '0',
+        'groups'                    => Array(
+                'base_dn'           => '$ldap_group_base_dn',
+                'filter'            => '$ldap_group_filter',
+                'object_classes'    => Array('top', 'groupOfUniqueNames'),
+                'member_attr'       => 'uniqueMember',
+            ),
+    );
 
 
-// This will overwrite defined filter
-\$rcmail_config['kolab_auth_filter'] = '(&' . '$ldap_user_filter' . '(|(uid=%u)(mail=%fu)(alias=%fu)))';
+    // This will overwrite defined filter
+    \$rcmail_config['kolab_auth_filter'] = '(&' . '$ldap_user_filter' . '(|(uid=%u)(mail=%fu)(alias=%fu)))';
 
-// Use this fields (from fieldmap configuration) to get authentication ID
-\$rcmail_config['kolab_auth_login'] = 'email';
+    // Use this fields (from fieldmap configuration) to get authentication ID
+    \$rcmail_config['kolab_auth_login'] = 'email';
 
-// Use this fields (from fieldmap configuration) for default identity
-\$rcmail_config['kolab_auth_name']  = 'name';
-\$rcmail_config['kolab_auth_alias'] = 'alias';
-\$rcmail_config['kolab_auth_email'] = 'email';
+    // Use this fields (from fieldmap configuration) for default identity
+    \$rcmail_config['kolab_auth_name']  = 'name';
+    \$rcmail_config['kolab_auth_alias'] = 'alias';
+    \$rcmail_config['kolab_auth_email'] = 'email';
 
-if (preg_match('/\/helpdesk-login\//', \$_SERVER["REQUEST_URI"]) ) {
+    if (preg_match('/\/helpdesk-login\//', \$_SERVER["REQUEST_URI"]) ) {
 
-    // Login and password of the admin user. Enables "Login As" feature.
-    \$rcmail_config['kolab_auth_admin_login']    = '$imap_admin_login';
-    \$rcmail_config['kolab_auth_admin_password'] = '$imap_admin_password';
+        // Login and password of the admin user. Enables "Login As" feature.
+        \$rcmail_config['kolab_auth_admin_login']    = '$imap_admin_login';
+        \$rcmail_config['kolab_auth_admin_password'] = '$imap_admin_password';
 
-    \$rcmail_config['kolab_auth_auditlog'] = true;
-}
+        \$rcmail_config['kolab_auth_auditlog'] = true;
+    }
 
-// Administrative role field (from fieldmap configuration) which must be filled with
-// specified value which adds privilege to login as another user.
-\$rcmail_config['kolab_auth_role']       = 'role';
-\$rcmail_config['kolab_auth_role_value'] = 'cn=kolab-admin,$ldap_base_dn';
+    // Administrative role field (from fieldmap configuration) which must be filled with
+    // specified value which adds privilege to login as another user.
+    \$rcmail_config['kolab_auth_role']       = 'role';
+    \$rcmail_config['kolab_auth_role_value'] = 'cn=kolab-admin,$ldap_base_dn';
 
-// Administrative group name to which user must be assigned to
-// which adds privilege to login as another user.
-\$rcmail_config['kolab_auth_group'] = 'Kolab Helpdesk';
+    // Administrative group name to which user must be assigned to
+    // which adds privilege to login as another user.
+    \$rcmail_config['kolab_auth_group'] = 'Kolab Helpdesk';
+
+    if (file_exists(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__)) {
+        include_once(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__));
+    }
 
 ?>
diff --git a/share/templates/roundcubemail/kolab_folders.inc.php.tpl b/share/templates/roundcubemail/kolab_folders.inc.php.tpl
index b0c7ea1..7f0598d 100644
--- a/share/templates/roundcubemail/kolab_folders.inc.php.tpl
+++ b/share/templates/roundcubemail/kolab_folders.inc.php.tpl
@@ -11,4 +11,9 @@
     \$rcmail_config['kolab_folders_mail_junkemail'] = 'Trash';
     \$rcmail_config['kolab_folders_mail_outbox'] = '';
     \$rcmail_config['kolab_folders_mail_wastebasket'] = '';
+
+    if (file_exists(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__)) {
+        include_once(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__));
+    }
+
 ?>
diff --git a/share/templates/roundcubemail/main.inc.php.tpl b/share/templates/roundcubemail/main.inc.php.tpl
index 05b0147..33229b8 100644
--- a/share/templates/roundcubemail/main.inc.php.tpl
+++ b/share/templates/roundcubemail/main.inc.php.tpl
@@ -111,9 +111,8 @@
             'contextmenu',
         );
 
-
-    if (file_exists(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/main.inc.php')) {
-        include_once(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/main.inc.php');
+    if (file_exists(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__)) {
+        include_once(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__));
     }
 
     // Re-apply mandatory settings here.
@@ -134,7 +133,6 @@
     \$rcmail_config['smtp_debug'] = true;
 
     \$rcmail_config['product_name'] = 'Kolab Groupware';
-
     \$rcmail_config['skin'] = 'larry';
     \$rcmail_config['skin_logo'] = 'skins/kolab/images/kolab_logo.png';
     \$rcmail_config['skin_include_php'] = false;
@@ -264,9 +262,4 @@
     \$rcmail_config['autocomplete_single'] = true;
 
     \$rcmail_config['htmleditor'] = 0;
-
-    include_once("/etc/roundcubemail/kolab_auth.inc.php");
-
-    \$rcmail_config['kolab_cache'] = true;
-
 ?>
diff --git a/share/templates/roundcubemail/managesieve.inc.php.tpl b/share/templates/roundcubemail/managesieve.inc.php.tpl
index c1a9fa3..48fa544 100644
--- a/share/templates/roundcubemail/managesieve.inc.php.tpl
+++ b/share/templates/roundcubemail/managesieve.inc.php.tpl
@@ -10,4 +10,9 @@
     \$rcmail_config['managesieve_replace_delimiter'] = '';
     \$rcmail_config['managesieve_disabled_extensions'] = array();
     \$rcmail_config['managesieve_debug'] = true;
+
+    if (file_exists(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__)) {
+        include_once(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__));
+    }
+
 ?>
diff --git a/share/templates/roundcubemail/owncloud.inc.php.tpl b/share/templates/roundcubemail/owncloud.inc.php.tpl
index 7410a53..f5268fa 100644
--- a/share/templates/roundcubemail/owncloud.inc.php.tpl
+++ b/share/templates/roundcubemail/owncloud.inc.php.tpl
@@ -1,4 +1,9 @@
 <?php
     // ownCloud URL
-    \$rcmail_config['owncloud_url'] = 'http://webmail.klab.cc/owncloud';
+    \$rcmail_config['owncloud_url'] = 'http://' . \$_SERVER["HTTP_HOST"] . '/owncloud';
+
+    if (file_exists(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__)) {
+        include_once(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__));
+    }
+
 ?>
\ No newline at end of file
diff --git a/share/templates/roundcubemail/password.inc.php.tpl b/share/templates/roundcubemail/password.inc.php.tpl
index 992ccc6..9fd28d3 100644
--- a/share/templates/roundcubemail/password.inc.php.tpl
+++ b/share/templates/roundcubemail/password.inc.php.tpl
@@ -1,151 +1,155 @@
 <?php
 
-// Password Plugin options
-// -----------------------
-// A driver to use for password change. Default: "sql".
-// See README file for list of supported driver names.
-\$rcmail_config['password_driver'] = 'ldap';
-
-// Determine whether current password is required to change password.
-// Default: false.
-\$rcmail_config['password_confirm_current'] = true;
-
-// Require the new password to be a certain length.
-// set to blank to allow passwords of any length
-\$rcmail_config['password_minimum_length'] = 6;
-
-// Require the new password to contain a letter and punctuation character
-// Change to false to remove this check.
-\$rcmail_config['password_require_nonalpha'] = false;
-
-// Enables logging of password changes into logs/password
-\$rcmail_config['password_log'] = true;
-
-
-// LDAP and LDAP_SIMPLE Driver options
-// -----------------------------------
-// LDAP server name to connect to.
-// You can provide one or several hosts in an array in which case the hosts are tried from left to right.
-// Exemple: array('ldap1.exemple.com', 'ldap2.exemple.com');
-// Default: 'localhost'
-\$rcmail_config['password_ldap_host'] = 'localhost';
-
-// LDAP server port to connect to
-// Default: '389'
-\$rcmail_config['password_ldap_port'] = '389';
-
-// TLS is started after connecting
-// Using TLS for password modification is recommended.
-// Default: false
-\$rcmail_config['password_ldap_starttls'] = false;
-
-// LDAP version
-// Default: '3'
-\$rcmail_config['password_ldap_version'] = '3';
-
-// LDAP base name (root directory)
-// Exemple: 'dc=exemple,dc=com'
-\$rcmail_config['password_ldap_basedn'] = '$ldap_user_base_dn';
-
-// LDAP connection method
-// There is two connection method for changing a user's LDAP password.
-// 'user': use user credential (recommanded, require password_confirm_current=true)
-// 'admin': use admin credential (this mode require password_ldap_adminDN and password_ldap_adminPW)
-// Default: 'user'
-\$rcmail_config['password_ldap_method'] = 'user';
-
-// LDAP Admin DN
-// Used only in admin connection mode
-// Default: null
-\$rcmail_config['password_ldap_adminDN'] = null;
-
-// LDAP Admin Password
-// Used only in admin connection mode
-// Default: null
-\$rcmail_config['password_ldap_adminPW'] = null;
-
-// LDAP user DN mask
-// The user's DN is mandatory and as we only have his login,
-// we need to re-create his DN using a mask
-// '%login' will be replaced by the current roundcube user's login
-// '%name' will be replaced by the current roundcube user's name part
-// '%domain' will be replaced by the current roundcube user's domain part
-// '%dc' will be replaced by domain name hierarchal string e.g. "dc=test,dc=domain,dc=com"
-// Exemple: 'uid=%login,ou=people,dc=exemple,dc=com'
-// \$rcmail_config['password_ldap_userDN_mask'] = 'uid=%login,ou=people,dc=exemple,dc=com';
-
-// LDAP search DN
-// The DN roundcube should bind with to find out user's DN
-// based on his login. Note that you should comment out the default
-// password_ldap_userDN_mask setting for this to take effect.
-// Use this if you cannot specify a general template for user DN with
-// password_ldap_userDN_mask. You need to perform a search based on
-// users login to find his DN instead. A common reason might be that
-// your users are placed under different ou's like engineering or
-// sales which cannot be derived from their login only.
-\$rcmail_config['password_ldap_searchDN'] = '$ldap_service_bind_dn';
-
-// LDAP search password
-// If password_ldap_searchDN is set, the password to use for
-// binding to search for user's DN. Note that you should comment out the default
-// password_ldap_userDN_mask setting for this to take effect.
-// Warning: Be sure to set approperiate permissions on this file so this password
-// is only accesible to roundcube and don't forget to restrict roundcube's access to
-// your directory as much as possible using ACLs. Should this password be compromised
-// you want to minimize the damage.
-\$rcmail_config['password_ldap_searchPW'] = '$ldap_service_bind_pw';
-
-// LDAP search base
-// If password_ldap_searchDN is set, the base to search in using the filter below.
-// Note that you should comment out the default password_ldap_userDN_mask setting
-// for this to take effect.
-\$rcmail_config['password_ldap_search_base'] = '$ldap_user_base_dn';
-
-// LDAP search filter
-// If password_ldap_searchDN is set, the filter to use when
-// searching for user's DN. Note that you should comment out the default
-// password_ldap_userDN_mask setting for this to take effect.
-// '%login' will be replaced by the current roundcube user's login
-// '%name' will be replaced by the current roundcube user's name part
-// '%domain' will be replaced by the current roundcube user's domain part
-// '%dc' will be replaced by domain name hierarchal string e.g. "dc=test,dc=domain,dc=com"
-// Example: '(uid=%login)'
-// Example: '(&(objectClass=posixAccount)(uid=%login))'
-\$rcmail_config['password_ldap_search_filter'] = '(&(|(uid=%login)(mail=%login)(mailAlternateAddress=%login)(alias=%login))(objectclass=kolabinetorgperson))';
-
-// LDAP password hash type
-// Standard LDAP encryption type which must be one of: crypt,
-// ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, or clear.
-// Please note that most encodage types require external libraries
-// to be included in your PHP installation, see function hashPassword in drivers/ldap.php for more info.
-// Default: 'crypt'
-\$rcmail_config['password_ldap_encodage'] = 'clear';
-
-// LDAP password attribute
-// Name of the ldap's attribute used for storing user password
-// Default: 'userPassword'
-\$rcmail_config['password_ldap_pwattr'] = 'userPassword';
-
-// LDAP password force replace
-// Force LDAP replace in cases where ACL allows only replace not read
-// See http://pear.php.net/package/Net_LDAP2/docs/latest/Net_LDAP2/Net_LDAP2_Entry.html#methodreplace
-// Default: true
-\$rcmail_config['password_ldap_force_replace'] = true;
-
-// LDAP Password Last Change Date
-// Some places use an attribute to store the date of the last password change
-// The date is meassured in "days since epoch" (an integer value)
-// Whenever the password is changed, the attribute will be updated if set (e.g. shadowLastChange)
-\$rcmail_config['password_ldap_lchattr'] = '';
-
-// LDAP Samba password attribute, e.g. sambaNTPassword
-// Name of the LDAP's Samba attribute used for storing user password
-\$rcmail_config['password_ldap_samba_pwattr'] = '';
-
-// LDAP Samba Password Last Change Date attribute, e.g. sambaPwdLastSet
-// Some places use an attribute to store the date of the last password change
-// The date is meassured in "seconds since epoch" (an integer value)
-// Whenever the password is changed, the attribute will be updated if set
-\$rcmail_config['password_ldap_samba_lchattr'] = '';
+    // Password Plugin options
+    // -----------------------
+    // A driver to use for password change. Default: "sql".
+    // See README file for list of supported driver names.
+    \$rcmail_config['password_driver'] = 'ldap';
+
+    // Determine whether current password is required to change password.
+    // Default: false.
+    \$rcmail_config['password_confirm_current'] = true;
+
+    // Require the new password to be a certain length.
+    // set to blank to allow passwords of any length
+    \$rcmail_config['password_minimum_length'] = 6;
+
+    // Require the new password to contain a letter and punctuation character
+    // Change to false to remove this check.
+    \$rcmail_config['password_require_nonalpha'] = false;
+
+    // Enables logging of password changes into logs/password
+    \$rcmail_config['password_log'] = true;
+
+
+    // LDAP and LDAP_SIMPLE Driver options
+    // -----------------------------------
+    // LDAP server name to connect to.
+    // You can provide one or several hosts in an array in which case the hosts are tried from left to right.
+    // Exemple: array('ldap1.exemple.com', 'ldap2.exemple.com');
+    // Default: 'localhost'
+    \$rcmail_config['password_ldap_host'] = 'localhost';
+
+    // LDAP server port to connect to
+    // Default: '389'
+    \$rcmail_config['password_ldap_port'] = '389';
+
+    // TLS is started after connecting
+    // Using TLS for password modification is recommended.
+    // Default: false
+    \$rcmail_config['password_ldap_starttls'] = false;
+
+    // LDAP version
+    // Default: '3'
+    \$rcmail_config['password_ldap_version'] = '3';
+
+    // LDAP base name (root directory)
+    // Exemple: 'dc=exemple,dc=com'
+    \$rcmail_config['password_ldap_basedn'] = '$ldap_user_base_dn';
+
+    // LDAP connection method
+    // There is two connection method for changing a user's LDAP password.
+    // 'user': use user credential (recommanded, require password_confirm_current=true)
+    // 'admin': use admin credential (this mode require password_ldap_adminDN and password_ldap_adminPW)
+    // Default: 'user'
+    \$rcmail_config['password_ldap_method'] = 'user';
+
+    // LDAP Admin DN
+    // Used only in admin connection mode
+    // Default: null
+    \$rcmail_config['password_ldap_adminDN'] = null;
+
+    // LDAP Admin Password
+    // Used only in admin connection mode
+    // Default: null
+    \$rcmail_config['password_ldap_adminPW'] = null;
+
+    // LDAP user DN mask
+    // The user's DN is mandatory and as we only have his login,
+    // we need to re-create his DN using a mask
+    // '%login' will be replaced by the current roundcube user's login
+    // '%name' will be replaced by the current roundcube user's name part
+    // '%domain' will be replaced by the current roundcube user's domain part
+    // '%dc' will be replaced by domain name hierarchal string e.g. "dc=test,dc=domain,dc=com"
+    // Exemple: 'uid=%login,ou=people,dc=exemple,dc=com'
+    // \$rcmail_config['password_ldap_userDN_mask'] = 'uid=%login,ou=people,dc=exemple,dc=com';
+
+    // LDAP search DN
+    // The DN roundcube should bind with to find out user's DN
+    // based on his login. Note that you should comment out the default
+    // password_ldap_userDN_mask setting for this to take effect.
+    // Use this if you cannot specify a general template for user DN with
+    // password_ldap_userDN_mask. You need to perform a search based on
+    // users login to find his DN instead. A common reason might be that
+    // your users are placed under different ou's like engineering or
+    // sales which cannot be derived from their login only.
+    \$rcmail_config['password_ldap_searchDN'] = '$ldap_service_bind_dn';
+
+    // LDAP search password
+    // If password_ldap_searchDN is set, the password to use for
+    // binding to search for user's DN. Note that you should comment out the default
+    // password_ldap_userDN_mask setting for this to take effect.
+    // Warning: Be sure to set approperiate permissions on this file so this password
+    // is only accesible to roundcube and don't forget to restrict roundcube's access to
+    // your directory as much as possible using ACLs. Should this password be compromised
+    // you want to minimize the damage.
+    \$rcmail_config['password_ldap_searchPW'] = '$ldap_service_bind_pw';
+
+    // LDAP search base
+    // If password_ldap_searchDN is set, the base to search in using the filter below.
+    // Note that you should comment out the default password_ldap_userDN_mask setting
+    // for this to take effect.
+    \$rcmail_config['password_ldap_search_base'] = '$ldap_user_base_dn';
+
+    // LDAP search filter
+    // If password_ldap_searchDN is set, the filter to use when
+    // searching for user's DN. Note that you should comment out the default
+    // password_ldap_userDN_mask setting for this to take effect.
+    // '%login' will be replaced by the current roundcube user's login
+    // '%name' will be replaced by the current roundcube user's name part
+    // '%domain' will be replaced by the current roundcube user's domain part
+    // '%dc' will be replaced by domain name hierarchal string e.g. "dc=test,dc=domain,dc=com"
+    // Example: '(uid=%login)'
+    // Example: '(&(objectClass=posixAccount)(uid=%login))'
+    \$rcmail_config['password_ldap_search_filter'] = '(&(|(uid=%login)(mail=%login)(mailAlternateAddress=%login)(alias=%login))(objectclass=kolabinetorgperson))';
+
+    // LDAP password hash type
+    // Standard LDAP encryption type which must be one of: crypt,
+    // ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, or clear.
+    // Please note that most encodage types require external libraries
+    // to be included in your PHP installation, see function hashPassword in drivers/ldap.php for more info.
+    // Default: 'crypt'
+    \$rcmail_config['password_ldap_encodage'] = 'clear';
+
+    // LDAP password attribute
+    // Name of the ldap's attribute used for storing user password
+    // Default: 'userPassword'
+    \$rcmail_config['password_ldap_pwattr'] = 'userPassword';
+
+    // LDAP password force replace
+    // Force LDAP replace in cases where ACL allows only replace not read
+    // See http://pear.php.net/package/Net_LDAP2/docs/latest/Net_LDAP2/Net_LDAP2_Entry.html#methodreplace
+    // Default: true
+    \$rcmail_config['password_ldap_force_replace'] = true;
+
+    // LDAP Password Last Change Date
+    // Some places use an attribute to store the date of the last password change
+    // The date is meassured in "days since epoch" (an integer value)
+    // Whenever the password is changed, the attribute will be updated if set (e.g. shadowLastChange)
+    \$rcmail_config['password_ldap_lchattr'] = '';
+
+    // LDAP Samba password attribute, e.g. sambaNTPassword
+    // Name of the LDAP's Samba attribute used for storing user password
+    \$rcmail_config['password_ldap_samba_pwattr'] = '';
+
+    // LDAP Samba Password Last Change Date attribute, e.g. sambaPwdLastSet
+    // Some places use an attribute to store the date of the last password change
+    // The date is meassured in "seconds since epoch" (an integer value)
+    // Whenever the password is changed, the attribute will be updated if set
+    \$rcmail_config['password_ldap_samba_lchattr'] = '';
+
+    if (file_exists(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__)) {
+        include_once(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__));
+    }
 
 ?>
diff --git a/share/templates/roundcubemail/terms.inc.php.tpl b/share/templates/roundcubemail/terms.inc.php.tpl
index 5faa888..a5292f2 100644
--- a/share/templates/roundcubemail/terms.inc.php.tpl
+++ b/share/templates/roundcubemail/terms.inc.php.tpl
@@ -1,18 +1,22 @@
 <?php
 
-/* terms plugin */
+    /* terms plugin */
 
-// log accepted terms
-\$rcmail_config['terms_log'] = true;
+    // log accepted terms
+    \$rcmail_config['terms_log'] = true;
 
-// renew agreement if older than YYYY-MM-DD HH:MM:SS
-// NOTICE: Must be in past and set accordingly to server Timezone!!!
-\$rcmail_config['terms_date'] = '2011-02-24 00:00:00';
+    // renew agreement if older than YYYY-MM-DD HH:MM:SS
+    // NOTICE: Must be in past and set accordingly to server Timezone!!!
+    \$rcmail_config['terms_date'] = '2011-02-24 00:00:00';
 
-// renew agreement automatically afer x days
-\$rcmail_config['terms_renew'] = 28; // 0 = never
+    // renew agreement automatically afer x days
+    \$rcmail_config['terms_renew'] = 28; // 0 = never
 
-// always request terms agreement after login
-\$rcmail_config['terms_always'] = false;
+    // always request terms agreement after login
+    \$rcmail_config['terms_always'] = false;
+
+    if (file_exists(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__)) {
+        include_once(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/' . basename(__FILE__));
+    }
 
 ?>


commit 77186dd4f9284e8bb89aaf900132f3dd70491173
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu Sep 6 12:32:25 2012 +0100

    Move setting the quota to outside of the loop where we login as the user

diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index cabd059..c6e3889 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -407,12 +407,6 @@ class IMAP(object):
                             "%s" % (additional_folders[additional_folder]["annotations"][annotation])
                         )
 
-            if additional_folders[additional_folder].has_key("quota"):
-                self.imap.sq(
-                        folder_name,
-                        additional_folders[additional_folder]['quota']
-                    )
-
             if additional_folders[additional_folder].has_key("acls"):
                 for acl in additional_folders[additional_folder]["acls"].keys():
                     self.imap.sam(
@@ -470,6 +464,14 @@ class IMAP(object):
         self.logout()
         self.connect(domain=self.domain)
 
+        for additional_folder in additional_folders.keys():
+            folder_name = additional_folder
+            if additional_folders[additional_folder].has_key("quota"):
+                self.imap.sq(
+                        folder_name,
+                        additional_folders[additional_folder]['quota']
+                    )
+
     def user_mailbox_delete(self, mailbox_base_name):
         """
             Delete a user mailbox.
@@ -834,7 +836,10 @@ class IMAP(object):
         return self.imap.lq(*args, **kw)
 
     def lqr(self, *args, **kw):
-        return self.imap.lqr(*args, **kw)
+        try:
+            return self.imap.lqr(*args, **kw)
+        except:
+            return (None, None, None)
 
     def undelete_mailfolder(self, *args, **kw):
         self.imap.undelete_mailfolder(*args, **kw)





More information about the commits mailing list