Projects
Kolab:3.4
pykolab
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 90
View file
pykolab-0.7.tar.gz/pykolab/setup/setup_freebusy.py
Changed
@@ -21,6 +21,7 @@ import os import sys import time +from urlparse import urlparse import components @@ -52,16 +53,62 @@ if not os.path.isfile('/etc/kolab-freebusy/config.ini'): os.rename('/etc/kolab-freebusy/config.ini.sample', '/etc/kolab-freebusy/config.ini') + imap_backend = conf.get('kolab', 'imap_backend') + admin_login = conf.get(imap_backend, 'admin_login') + admin_password = conf.get(imap_backend, 'admin_password') + imap_uri = conf.get(imap_backend, 'imap_uri') + if imap_uri == None: + imap_uri = conf.get(imap_backend, 'uri') + + scheme = None + hostname = None + port = None + + result = urlparse(imap_uri) + + if hasattr(result, 'hostname'): + hostname = result.hostname + else: + scheme = imap_uri.split(':')[0] + (hostname, port) = imap_uri.split('/')[2].split(':') + + if port == None: + port = 993 + + if scheme == None or scheme == "": + scheme = 'imaps' + + resources_imap_uri = '%s://%s:%s@%s:%s/%%kolabtargetfolder?acl=lrs' % (scheme, admin_login, admin_password, hostname, port) + users_imap_uri = '%s://%%mail:%s@%s:%s/?proxy_auth=%s' % (scheme, admin_password, hostname, port, admin_login) + freebusy_settings = { - 'directory "kolab-ldap"': { + 'directory "kolab-users"': { + 'type': 'ldap', 'host': conf.get('ldap', 'ldap_uri'), 'base_dn': conf.get('ldap', 'base_dn'), 'bind_dn': conf.get('ldap', 'service_bind_dn'), 'bind_pw': conf.get('ldap', 'service_bind_pw'), - 'fbsource': 'file:/var/lib/kolab-freebusy/%mail.ifb', + 'filter': '(&(objectClass=kolabInetOrgPerson)(|(uid=%s)(mail=%s)(alias=%s)))', + 'attributes': 'mail', + 'lc_attributes': 'mail', + 'fbsource': users_imap_uri, + 'cacheto': '/var/cache/kolab-freebusy/%mail.ifb', + 'expires': '15m', + 'loglevel': 300, + }, + 'directory "kolab-resources"': { + 'type': 'ldap', + 'host': conf.get('ldap', 'ldap_uri'), + 'base_dn': conf.get('ldap', 'resource_base_dn'), + 'bind_dn': conf.get('ldap', 'service_bind_dn'), + 'bind_pw': conf.get('ldap', 'service_bind_pw'), + 'attributes': 'mail, kolabtargetfolder', + 'filter': '(&(objectClass=kolabsharedfolder)(mail=%s))', + 'fbsource': resources_imap_uri, + 'cacheto': '/var/cache/kolab-freebusy/%mail.ifb', + 'expires': '15m', + 'loglevel': 300 }, - 'httpauth': { - } } cfg_parser = RawConfigParser() @@ -73,6 +120,9 @@ continue for key in freebusy_settings[section].keys(): + if not cfg_parser.has_section(section): + cfg_parser.add_section(section) + cfg_parser.set(section, key, freebusy_settings[section][key]) fp = open('/etc/kolab-freebusy/config.ini', "w+")
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.