예제 #1
0
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

from ConfigParser import ConfigParser
import hashlib
import OpenSSL
import os
import StringIO
import subprocess
import sys

from pykolab.translate import _

import pykolab
log = pykolab.getLogger('pykolab.conf')


class Entitlement(object):
    def __init__(self, *args, **kw):
        self.entitlement = {}

        self.entitlement_files = []

        ca_cert_file = '/etc/pki/tls/certs/mirror.kolabsys.com.ca.cert'
        customer_cert_file = '/etc/pki/tls/private/mirror.kolabsys.com.client.pem'
        customer_key_file = '/etc/pki/tls/private/mirror.kolabsys.com.client.pem'

        # Licence lock and key verification.
        self.entitlement_verification = [
            'f700660f456a60c92ab2f00d0f1968230920d89829d42aa27d30f678',
예제 #2
0
파일: __init__.py 프로젝트: detrout/pykolab
import json
import httplib
import sys
from urlparse import urlparse

import pykolab

from pykolab import utils
from pykolab.translate import _

log = pykolab.getLogger('pykolab.wap_client')
conf = pykolab.getConf()

if not hasattr(conf, 'defaults'):
    conf.finalize_conf()

API_HOSTNAME = "localhost"
API_SCHEME = "http"
API_PORT = 80
API_BASE = "/kolab-webadmin/api/"

kolab_wap_url = conf.get('kolab_wap', 'api_url')

if not kolab_wap_url == None:
    result = urlparse(kolab_wap_url)
else:
    result = None

if hasattr(result, 'hostname'):
    API_HOSTNAME = result.hostname
예제 #3
0
import grp
import os
import pwd
import shutil
import sys
import time
import traceback

import pykolab

from pykolab import utils
from pykolab.auth import Auth
from pykolab.constants import *
from pykolab.translate import _

log = pykolab.getLogger('saslauthd')
conf = pykolab.getConf()

class SASLAuthDaemon(object):
    def __init__(self):
        daemon_group = conf.add_cli_parser_option_group(_("Daemon Options"))

        daemon_group.add_option(
                "--fork",
                dest    = "fork_mode",
                action  = "store_true",
                default = False,
                help    = _("Fork to the background.")
            )

        daemon_group.add_option(
예제 #4
0
파일: __init__.py 프로젝트: detrout/pykolab
import logging
import os
import sys

from optparse import OptionParser
from ConfigParser import SafeConfigParser

import pykolab

from pykolab.conf.defaults import Defaults

from pykolab.constants import *
from pykolab.translate import _

log = pykolab.getLogger('pykolab.conf')

class Conf(object):
    def __init__(self):
        """
            self.cli_args == Arguments passed on the CLI
            self.cli_keywords == Parser results (again, CLI)
            self.cli_parser == The actual Parser (from OptionParser)
            self.plugins == Our Kolab Plugins
        """

        self.cli_parser = None
        self.cli_args = None
        self.cli_keywords = None

        self.entitlement = None
예제 #5
0
파일: __init__.py 프로젝트: cdp1337/pykolab
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import logging
import os
import pdb
import sys
import traceback

import pykolab

from pykolab.translate import _

log = pykolab.getLogger('pykolab.plugins')
conf = pykolab.getConf()

class KolabPlugins(object):
    """
        Detects, loads and interfaces with plugins for different
        Kolab components.
    """
    def __init__(self):
        """
            Searches the plugin directory for plugins, and loads
            them into a list.
        """
        self.plugins = {}

        for plugin_path in [
예제 #6
0
try:
    from sqlalchemy.orm import sessionmaker
except:
    from sqlalchemy.orm import create_session

from sqlalchemy.schema import Index
from sqlalchemy.schema import UniqueConstraint

import pykolab

from pykolab import utils
from pykolab.translate import _

conf = pykolab.getConf()
log = pykolab.getLogger('pykolab.telemetry')

metadata = MetaData()

##
## Classes
##


class TelemetryCommand(object):
    def __init__(self, command):
        self.command = command


class TelemetryCommandArg(object):
예제 #7
0
파일: __init__.py 프로젝트: cdp1337/pykolab
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import pykolab

from pykolab import utils
from pykolab.auth import Auth
from pykolab.translate import _

conf = pykolab.getConf()
log = pykolab.getLogger('pykolab.plugin_sievemgmt')

import sys
import time
from urlparse import urlparse

class KolabSievemgmt(object):
    """
        Plugin to manage Sieve scripts according to KEP #14.
    """

    def __init__(self):
        pass

    def add_options(self, *args,  **kw):
        pass
예제 #8
0
from ConfigParser import RawConfigParser
import os
import sys
import time
from urlparse import urlparse

import components

import pykolab

from pykolab import utils
from pykolab.constants import *
from pykolab.translate import _

log = pykolab.getLogger('pykolab.setup')
conf = pykolab.getConf()

def __init__():
    components.register(
            'freebusy',
            execute,
            description=description(),
            after=['ldap']
        )

def description():
    return _("Setup Free/Busy.")

def execute(*args, **kw):
    if not os.path.isfile('/etc/kolab-freebusy/config.ini') and not os.path.isfile('/etc/kolab-freebusy/config.ini.sample'):
예제 #9
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import pykolab

from pykolab import utils
from pykolab.translate import _

conf = pykolab.getConf()
log = pykolab.getLogger('pykolab.plugins.recipientpolicy')


class KolabRecipientpolicy(object):
    """
        Example plugin making quota adjustments given arbitrary conditions.
    """
    def __init__(self):
        pass

    def add_options(self, *args, **kw):
        pass

    #def mail_domain_space_policy_check(self, kw={}, args=()):
    #(mail, alternative_mail, domain_name, domain_root_dn) = args
예제 #10
0
파일: translit.py 프로젝트: cdp1337/pykolab
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import pykolab
from pykolab.translate import _

log = pykolab.getLogger('pykolab.translit')

locale_translit_map = {
        'ru_RU': 'cyrillic'
    }

translit_map = {
        'cyrillic': {
                u'А': 'A',
                u'а': 'a',
                u'Б': 'B',
                u'б': 'b',
                u'В': 'V',
                u'в': 'v',
                u'Г': 'G',
                u'г': 'g',
예제 #11
0
import grp
import os
import pwd
import shutil
import sys
import time
import traceback

import pykolab

from pykolab import utils
from pykolab.auth import Auth
from pykolab.constants import *
from pykolab.translate import _

log = pykolab.getLogger('saslauthd')
conf = pykolab.getConf()


class SASLAuthDaemon(object):
    def __init__(self):
        daemon_group = conf.add_cli_parser_option_group(_("Daemon Options"))

        daemon_group.add_option("--fork",
                                dest="fork_mode",
                                action="store_true",
                                default=False,
                                help=_("Fork to the background."))

        daemon_group.add_option(
            "-p",
예제 #12
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

import os
import pykolab
import subprocess

from pykolab.translate import _

log = pykolab.getLogger('pykolab.plugins.roundcubedb')
conf = pykolab.getConf()


class KolabRoundcubedb(object):
    """
        Pykolab plugin to update Roundcube's database on Kolab users db changes
    """
    def __init__(self):
        pass

    def add_options(self, *args, **kw):
        pass

    def user_delete(self, *args, **kw):
        """
예제 #13
0
파일: __init__.py 프로젝트: cdp1337/pykolab
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import pykolab

from pykolab.translate import _

log = pykolab.getLogger('pykolab.plugins.defaultfolders')
conf = pykolab.getConf()

class KolabDefaultfolders(object):
    """
        Example plugin to create a set of default folders.
    """

    def __init__(self):
        pass

    def add_options(self, *args,  **kw):
        pass

    def create_user_folders(self, *args, **kw):
        """
예제 #14
0
파일: todo.py 프로젝트: tpokorra/pykolab
import datetime
import kolabformat
import icalendar
import pytz

import pykolab
from pykolab import constants
from pykolab.xml import Event
from pykolab.xml import utils as xmlutils
from pykolab.xml.event import InvalidEventDateError
from pykolab.translate import _

log = pykolab.getLogger('pykolab.xml_todo')

def todo_from_ical(string):
    return Todo(from_ical=string)

def todo_from_string(string):
    return Todo(from_string=string)

def todo_from_message(message):
    todo = None
    if message.is_multipart():
        for part in message.walk():
            if part.get_content_type() == "application/calendar+xml":
                payload = part.get_payload(decode=True)
                todo = todo_from_string(payload)

            # append attachment parts to Todo object
            elif todo and part.has_key('Content-ID'):
                todo._attachment_parts.append(part)
예제 #15
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import pykolab

from pykolab.translate import _

conf = pykolab.getConf()
log = pykolab.getLogger('pykolab.plugins.dynamicquota')


class KolabDynamicquota(object):
    """
        Example plugin making quota adjustments given arbitrary conditions.
    """
    def __init__(self):
        pass

    def add_options(self, *args, **kw):
        pass

    def set_user_folder_quota(self, *args, **kw):
        """
            The arguments passed to the 'set_user_folder_quota' hook:
예제 #16
0
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import os
import tempfile
import time

from email import message_from_file
from email.encoders import encode_quopri

import modules
import pykolab

from pykolab.translate import _

log = pykolab.getLogger('pykolab.wallace')
conf = pykolab.getConf()

mybasepath = '/var/spool/pykolab/wallace/footer/'

def __init__():
    modules.register('footer', execute, description=description())

def description():
    return """Append a footer to messages."""

def set_part_content(part, content):
    # Reset old encoding and use quoted-printable (#5414)
    del part['Content-Transfer-Encoding']
    part.set_payload(content)
    encode_quopri(part)
예제 #17
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import pykolab

from pykolab.translate import _

conf = pykolab.getConf()
log = pykolab.getLogger('pykolab.plugins.dynamicquota')

class KolabDynamicquota(object):
    """
        Example plugin making quota adjustments given arbitrary conditions.
    """

    def __init__(self):
        pass

    def add_options(self, *args,  **kw):
        pass

    def set_user_folder_quota(self, *args, **kw):
        """
            The arguments passed to the 'set_user_folder_quota' hook:
예제 #18
0
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import ldap
import sys

import commands

import pykolab

from pykolab import imap_utf7
from pykolab.auth import Auth
from pykolab.imap import IMAP
from pykolab.translate import _

log = pykolab.getLogger('pykolab.cli')
conf = pykolab.getConf()


def __init__():
    commands.register('mailbox_cleanup', execute, description=description())


def cli_options():
    my_option_group = conf.add_cli_parser_option_group(_("CLI Options"))
    my_option_group.add_option(
        '--dry-run',
        dest="dryrun",
        action="store_true",
        default=False,
        help=
예제 #19
0
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import base64
import getpass
import grp
import os
import pwd
import struct
import sys

import pykolab
from pykolab import constants
from pykolab.translate import _

log = pykolab.getLogger('pykolab.utils')
conf = pykolab.getConf()

def ask_question(question, default="", password=False, confirm=False):
    """
        Ask a question on stderr.

        Since the answer to the question may actually be a password, cover that
        case with a getpass.getpass() prompt.

        Accepts a default value, but ignores defaults for password prompts.

        Usage: pykolab.utils.ask_question("What is the server?", default="localhost")
    """
    
    if not default == "" and not default == None and conf.cli_keywords.answer_default:
예제 #20
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import pykolab

from pykolab import utils
from pykolab.translate import _

conf = pykolab.getConf()
log = pykolab.getLogger('pykolab.plugins.recipientpolicy')

class KolabRecipientpolicy(object):
    """
        Example plugin making quota adjustments given arbitrary conditions.
    """

    def __init__(self):
        pass

    def add_options(self, *args,  **kw):
        pass

    #def mail_domain_space_policy_check(self, kw={}, args=()):
        #(mail, alternative_mail, domain_name, domain_root_dn) = args
예제 #21
0
파일: __init__.py 프로젝트: cdp1337/pykolab
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import logging
import os
import time

import pykolab
import pykolab.base

from pykolab.translate import _

log = pykolab.getLogger('pykolab.auth')
conf = pykolab.getConf()


class Auth(pykolab.base.Base):
    """
        This is the Authentication and Authorization module for PyKolab.
    """
    def __init__(self, domain=None):
        """
            Initialize the authentication class.
        """
        pykolab.base.Base.__init__(self, domain=domain)

        self._auth = None
예제 #22
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

import os
import pykolab
import subprocess

from pykolab.translate import _

log = pykolab.getLogger('pykolab.plugins.roundcubedb')
conf = pykolab.getConf()

class KolabRoundcubedb(object):
    """
        Pykolab plugin to update Roundcube's database on Kolab users db changes
    """

    def __init__(self):
        pass

    def add_options(self, *args,  **kw):
        pass

    def user_delete(self, *args, **kw):
        """
예제 #23
0
파일: cyrus.py 프로젝트: tpokorra/pykolab
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import cyruslib
import sys
import time

from urlparse import urlparse

import pykolab

from pykolab.imap import IMAP
from pykolab.translate import _

log = pykolab.getLogger('pykolab.imap')
conf = pykolab.getConf()

class Cyrus(cyruslib.CYRUS):
    """
        Abstraction class for some common actions to do exclusively in Cyrus.

        For example, the following functions require the commands to be
        executed against the backend server if a murder is being used.

        - Setting quota
        - Renaming the top-level mailbox
        - Setting annotations

    """
예제 #24
0
파일: __init__.py 프로젝트: detrout/pykolab
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

import pykolab

from pykolab.translate import _

log = pykolab.getLogger('pykolab.plugins.defaultfolders')
conf = pykolab.getConf()

class KolabDefaultfolders(object):
    """
        Example plugin to create a set of default folders.
    """

    def __init__(self):
        pass

    def add_options(self, *args,  **kw):
        pass

    def create_user_folders(self, *args, **kw):
        """
예제 #25
0
except:
    from sqlalchemy.orm import relation as relationship

try:
    from sqlalchemy.orm import sessionmaker
except:
    from sqlalchemy.orm import create_session

import pykolab

from pykolab import utils
from pykolab.constants import KOLAB_LIB_PATH
from pykolab.translate import _

conf = pykolab.getConf()
log = pykolab.getLogger('pykolab.auth_cache')

metadata = MetaData()

db = {}

##
## Classes
##

class Entry(object):
    def __init__(self, uniqueid, result_attr, last_change):
        self.uniqueid = uniqueid
        self.result_attribute = result_attr

        modifytimestamp_format = conf.get_raw('ldap', 'modifytimestamp_format')
예제 #26
0
sys.stderr = open('/dev/null', 'a')

name = 'kolab_sieve'
description = "Sieve Script Management for Kolab Groupware on UCS"

# The filter has to be composed to make sure only Kolab Groupware
# related objects are passed along to this listener module.
filter = '(objectClass=kolabInetOrgPerson)'
#attributes = [ '*' ]

import pykolab
from pykolab import constants
from pykolab import utils

log = pykolab.getLogger('pykolab.listener')
log.remove_stdout_handler()
log.setLevel(logging.DEBUG)
log.debuglevel = 9

conf = pykolab.getConf()
conf.finalize_conf(fatal=False)
conf.debuglevel = 9

from pykolab.auth import Auth


def handler(*args, **kw):
    auth = Auth()
    auth.connect()
예제 #27
0
#sys.stderr = open('/dev/null', 'a')

name = 'kolab'
description = "Kolab Groupware Listener for UCS"

# The filter has to be composed to make sure only Kolab Groupware
# related objects are passed along to this listener module.
filter = '(|(objectClass=kolabInetOrgPerson)(objectClass=univentionMailSharedFolder))'
#attributes = [ '*' ]

import pykolab
from pykolab import constants
from pykolab import utils

log = pykolab.getLogger('pykolab.listener')
#log.remove_stdout_handler()
log.setLevel(logging.DEBUG)
log.debuglevel = 9

conf = pykolab.getConf()
conf.finalize_conf(fatal=False)
conf.debuglevel = 9

from pykolab.auth import Auth

def handler(*args, **kw):
    log.info("kolab.handler(args(%d): %r, kw: %r)" % (len(args), args, kw))

    auth = Auth()
    auth.connect()
예제 #28
0
from email.utils import formataddr
from email.utils import getaddresses

import modules

import pykolab

from pykolab.auth import Auth
from pykolab.conf import Conf
from pykolab.imap import IMAP
from pykolab.xml import event_from_ical
from pykolab.xml import event_from_string
from pykolab.xml import to_dt
from pykolab.translate import _

log = pykolab.getLogger('pykolab.wallace')
conf = pykolab.getConf()

mybasepath = '/var/spool/pykolab/wallace/resources/'

auth = None
imap = None

def __init__():
    modules.register('resources', execute, description=description())

def accept(filepath):
    new_filepath = os.path.join(
            mybasepath,
            'ACCEPT',
            os.path.basename(filepath)
예제 #29
0
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import logging
import os
import time

import pykolab
import pykolab.base

from pykolab.translate import _

log = pykolab.getLogger('pykolab.auth')
conf = pykolab.getConf()

class Auth(pykolab.base.Base):
    """
        This is the Authentication and Authorization module for PyKolab.
    """

    def __init__(self, domain=None):
        """
            Initialize the authentication class.
        """
        pykolab.base.Base.__init__(self, domain=domain)

        self._auth = None
예제 #30
0
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import os
import subprocess

import components

import pykolab

from pykolab import utils
from pykolab.constants import *
from pykolab.translate import _
from augeas import Augeas

log = pykolab.getLogger('pykolab.setup')
conf = pykolab.getConf()


def __init__():
    components.register('kolabd',
                        execute,
                        description=description(),
                        after=['ldap', 'imap'])


def description():
    return _("Setup the Kolab daemon.")


def execute(*args, **kw):
예제 #31
0
    from sqlalchemy.orm import create_session

from sqlalchemy.schema import Index
from sqlalchemy.schema import UniqueConstraint

sys.path = ['..'] + sys.path

import pykolab

from pykolab import utils
from pykolab.auth import Auth
from pykolab.constants import *
from pykolab.translate import _

# TODO: Figure out how to make our logger do some syslogging as well.
log = pykolab.getLogger('pykolab.smtp_access_policy')

# TODO: Removing the stdout handler would mean one can no longer test by
# means of manual execution in debug mode.
log.remove_stdout_handler()

conf = pykolab.getConf()

#
# Caching routines using SQLAlchemy.
#
# If creating the cache fails, we continue without any caching, significantly
# increasing the load on LDAP.
#
cache_expire = 3600
try:
예제 #32
0
파일: __init__.py 프로젝트: cdp1337/pykolab
#


import logging
import re
import time
import socket
import sys

from urlparse import urlparse

import pykolab
from pykolab import utils
from pykolab.translate import _

log = pykolab.getLogger('pykolab.imap')
conf = pykolab.getConf()

class IMAP(object):
    def __init__(self):
        # Pool of named IMAP connections, by hostname
        self._imap = {}

        # Place holder for the current IMAP connection
        self.imap = None

    def cleanup_acls(self, aci_subject):
        lm_suffix = ""

        log.info(_("Cleaning up ACL entries for %s across all folders") % (aci_subject))
예제 #33
0
import pwd
import shutil
import sys
import time
import traceback

import pykolab

from pykolab.auth import Auth
from pykolab import constants
from pykolab import utils
from pykolab.translate import _

from process import KolabdProcess as Process

log = pykolab.getLogger('pykolab.daemon')
conf = pykolab.getConf()


class KolabDaemon(object):
    def __init__(self):
        """
            The main Kolab Groupware daemon process.
        """

        daemon_group = conf.add_cli_parser_option_group(_("Daemon Options"))

        daemon_group.add_option("--fork",
                                dest="fork_mode",
                                action="store_true",
                                default=False,
예제 #34
0
from sqlalchemy.schema import Index
from sqlalchemy.schema import UniqueConstraint

sys.path.append('..')
sys.path.append('../..')

import pykolab

from pykolab.auth import Auth
from pykolab.constants import KOLAB_LIB_PATH
from pykolab import telemetry
from pykolab.translate import _

# TODO: Figure out how to make our logger do some syslogging as well.
log = pykolab.getLogger('pykolab.parse_telemetry')

# TODO: Removing the stdout handler would mean one can no longer test by
# means of manual execution in debug mode.
#log.remove_stdout_handler()

conf = pykolab.getConf()
conf.finalize_conf()

auth = Auth()

db = telemetry.init_db()

while True:
    try:
        log_file = conf.cli_args.pop(0)
예제 #35
0
파일: cache.py 프로젝트: detrout/pykolab
except:
    from sqlalchemy.orm import relation as relationship

try:
    from sqlalchemy.orm import sessionmaker
except:
    from sqlalchemy.orm import create_session

import pykolab

from pykolab import utils
from pykolab.constants import KOLAB_LIB_PATH
from pykolab.translate import _

conf = pykolab.getConf()
log = pykolab.getLogger('pykolab.auth_cache')

metadata = MetaData()

db = None

##
## Classes
##

class Entry(object):
    def __init__(self, uniqueid, result_attr, last_change):
        self.uniqueid = uniqueid
        self.result_attribute = result_attr

        modifytimestamp_format = conf.get('ldap', 'modifytimestamp_format')
예제 #36
0
파일: process.py 프로젝트: tpokorra/pykolab
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import multiprocessing
import os
import time

import pykolab
from pykolab.auth import Auth
from pykolab.translate import _

log = pykolab.getLogger('pykolab.daemon')
conf = pykolab.getConf()

class KolabdProcess(multiprocessing.Process):
    def __init__(self, domain):
        self.domain = domain
        log.debug(_("Process created for domain %s") % (domain), level=8)
        multiprocessing.Process.__init__(
                self,
                target=self.synchronize,
                args=(domain,),
                name="Kolab(%s)" % domain
            )

    def synchronize(self, domain):
        log.debug(_("Synchronizing for domain %s") % (domain), level=8)
예제 #37
0
#!/usr/bin/python

import anydbm
import ldap
import ldap.syncrepl
import ldapurl

import pykolab

from pykolab import utils

log = pykolab.getLogger('pykolab.syncrepl')
conf = pykolab.getConf()


class DNSync(ldap.ldapobject.LDAPObject, ldap.syncrepl.SyncreplConsumer):

    callback = None

    def __init__(self, filename, *args, **kwargs):
        if kwargs.has_key('callback'):
            self.callback = kwargs['callback']
            del kwargs['callback']

        ldap.ldapobject.LDAPObject.__init__(self, *args, **kwargs)
        self.__db = anydbm.open(filename, 'c', 0640)
        self.__presentUUIDs = {}

    def syncrepl_set_cookie(self, cookie):
        self.__db['cookie'] = cookie
예제 #38
0
파일: event.py 프로젝트: detrout/pykolab
from icalendar import vDatetime
from icalendar import vText
import kolabformat
import pytz
import time
import uuid

import pykolab
from pykolab import constants
from pykolab import utils
from pykolab.translate import _

from attendee import Attendee
from contact_reference import ContactReference

log = pykolab.getLogger('pykolab.xml_event')

def event_from_ical(string):
    return Event(from_ical=string)

def event_from_string(string):
    return Event(from_string=string)

class Event(object):
    status_map = {
            "TENTATIVE": kolabformat.StatusTentative,
            "CONFIRMED": kolabformat.StatusConfirmed,
            "CANCELLED": kolabformat.StatusCancelled,
        }

    def __init__(self, from_ical="", from_string=""):
예제 #39
0
파일: todo.py 프로젝트: cdp1337/pykolab
import datetime
import kolabformat
import icalendar
import pytz
import base64

import pykolab
from pykolab import constants
from pykolab.xml import Event
from pykolab.xml import RecurrenceRule
from pykolab.xml import utils as xmlutils
from pykolab.xml.event import InvalidEventDateError
from pykolab.translate import _

log = pykolab.getLogger('pykolab.xml_todo')


def todo_from_ical(ical, string=None):
    return Todo(from_ical=ical, from_string=string)


def todo_from_string(string):
    return Todo(from_string=string)


def todo_from_message(message):
    todo = None
    if message.is_multipart():
        for part in message.walk():
            if part.get_content_type() == "application/calendar+xml":
                payload = part.get_payload(decode=True)
예제 #40
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import commands

import pykolab

from pykolab.imap import IMAP
from pykolab.translate import _

log = pykolab.getLogger('pykolab.cli')
conf = pykolab.getConf()

def __init__():
    commands.register('undelete_mailbox', execute, description=description())

def cli_options():
    my_option_group = conf.add_cli_parser_option_group(_("CLI Options"))
    my_option_group.add_option( '--dry-run',
                                dest    = "dry_run",
                                action  = "store_true",
                                default = False,
                                help    = _("Do not actually execute, but state what would have been executed."))

def description(*args, **kw):
    return _("Recover mailboxes previously deleted.")
예제 #41
0
파일: __init__.py 프로젝트: cdp1337/pykolab
import json
import httplib
import urllib
import sys
from urlparse import urlparse

import pykolab

from pykolab import utils
from pykolab.translate import _

log = pykolab.getLogger('pykolab.wap_client')
conf = pykolab.getConf()

if not hasattr(conf, 'defaults'):
    conf.finalize_conf()

API_HOSTNAME = "localhost"
API_SCHEME = "http"
API_PORT = 80
API_SSL = False
API_BASE = "/kolab-webadmin/api/"

kolab_wap_url = conf.get('kolab_wap', 'api_url')

if not kolab_wap_url == None:
    result = urlparse(kolab_wap_url)
else:
    result = None