[Python-kolab-commits] r7 - trunk/python-kolab/kolab/kldap

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 22 18:26:56 CET 2007


Author: wrobel
Date: 2007-02-22 18:26:55 +0100 (Thu, 22 Feb 2007)
New Revision: 7

Added:
   trunk/python-kolab/kolab/kldap/kldap.py
Removed:
   trunk/python-kolab/kolab/kldap/kolab.py
Log:
May not have a kolab module in here.

Copied: trunk/python-kolab/kolab/kldap/kldap.py (from rev 5, trunk/python-kolab/kolab/kldap/kolab.py)

Deleted: trunk/python-kolab/kolab/kldap/kolab.py
===================================================================
--- trunk/python-kolab/kolab/kldap/kolab.py	2007-02-22 17:26:41 UTC (rev 6)
+++ trunk/python-kolab/kolab/kldap/kolab.py	2007-02-22 17:26:55 UTC (rev 7)
@@ -1,100 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#################################################################################
-# PYTHON-KOLAB KOLAB-LDAP HANDLER
-#################################################################################
-# File:       kolab.py
-#
-#             Kolab specific LDAP management.
-#
-# Copyright:
-#             (c) 2005 - 2007 Pardus
-#             Distributed under the terms of the GNU General Public License v2
-#
-# Author(s):
-#             Gunnar Wrobel <p at rdus.de>
-#
-# $Id$
-'''Kolab specific LDAP functions.'''
-
-__version__ = '$Id$'
-
-#===============================================================================
-#
-# Dependencies
-#
-#-------------------------------------------------------------------------------
-
-from   kolab.kldap.kldap    import Ldap
-from   kolab.kldap.utils    import objectclass_filter
-
-#================================================================================
-#
-# KolabLdap class
-#
-#--------------------------------------------------------------------------------
-
-class KolabLdap(Ldap):
-    ''' This class handles configuration data stored in a ldap
-    directory. The values are being read using the ldap modules. It
-    extends the LdapStorage definition and adds a few kolab specific
-    features. 
-    '''
-
-    def enable_nobody(self):
-        '''Temporarily activates the "nobody" user.'''
-
-        if self.current_user != 'nobody':
-            self.old_user = self.current_user
-            self.set_auth('nobody')
-
-    def disable_nobody(self):
-        '''Deactivates the "nobody" user.'''
-
-        if self.current_user == 'nobody' and self.old_user:
-            self.old_user = ''
-            self.set_auth(self.old_user)
-
-    def dn_for_object(self, value, attr, classes = ['*']):
-        '''Returns a list of dn's that match the attr=value combination.'''
-
-        ofilter = objectclass_filter(classes)
-
-        self.require_connect()
-
-        result = self.ldap.search_s(self.base_dn, ldap.SCOPE_SUBTREE, '(&' +
-                                    ofilter + '(' + attr + '=' +
-                                    escape_for_filter(value) + '))',
-                                    attrsonly = 1)
-        if result:
-            # Returns the first half of the tuple which is the dn
-            # The base dn is removed from the entries
-            return [i[0][:-(len(self.base_dn) + 1)] for i in result]
-        else:
-            raise StorageException('No object found!')
-
-    def dn_for_mail(self, mail, classes = ['*']):
-        '''Returns a list of dn's that own the given e-mail address. This
-        should usually result in a maximum of one entry.'''
-
-        self.require_connect()
-
-        dist_name = []
-        for i in ['uid', 'mail', 'alias']:
-            try:
-                dist_name.append((self.dn_for_object(mail, i, classes), i))
-                break
-            except StorageException, e:
-                pass
-
-        return dist_name
-
-#================================================================================
-#
-# Testing
-#
-#--------------------------------------------------------------------------------
-
-if __name__ == '__main__':
-    import doctest, sys
-    doctest.testmod(sys.modules[__name__])



More information about the Python-kolab-commits mailing list