Branch 'pykolab-0.5' - 2 commits - pykolab/auth
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Wed May 22 13:16:28 CEST 2013
pykolab/auth/ldap/__init__.py | 8 ++++++++
pykolab/auth/ldap/syncrepl.py | 27 ++++++++++++++++++++++++++-
2 files changed, 34 insertions(+), 1 deletion(-)
New commits:
commit 70d9da4a57441a752fa0a8098aca345f91e6d3c6
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Wed May 22 13:15:15 2013 +0200
Upon deletion of an entry, see if we can get to the value of the result attribute using our cache
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 413ebf8..118a6d8 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1771,6 +1771,14 @@ class LDAP(pykolab.base.Base):
else:
change = change_dict['change_type']
+ # See if we can find the cache entry - this way we can get to
+ # the value of a (former, on a deleted entry) result_attribute
+ cache_entry = cache.get_entry(self.domain, entry, update=False)
+ result_attribute = conf.get('cyrus-sasl', 'result_attribute')
+
+ if hasattr(cache_entry, 'result_attribute') and change == 'delete':
+ entry[result_attribute] = cache_entry.result_attribute
+
eval(
"self._change_%s_%s(entry, change_dict)" % (
change,
commit 2ea1d290988ca83ff9947ea942a8a4e033e51020
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Wed May 22 13:10:14 2013 +0200
Make sure we ship the value of the unique attribute back to the callback (#1875)
diff --git a/pykolab/auth/ldap/syncrepl.py b/pykolab/auth/ldap/syncrepl.py
index e02e086..03ab5ae 100644
--- a/pykolab/auth/ldap/syncrepl.py
+++ b/pykolab/auth/ldap/syncrepl.py
@@ -5,8 +5,13 @@ 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
@@ -28,16 +33,36 @@ class DNSync(ldap.ldapobject.LDAPObject,ldap.syncrepl.SyncreplConsumer):
return self.__db['cookie']
def syncrepl_delete(self, uuids):
+ log.debug("syncrepl_delete uuids: %r" % (uuids), level=8)
+
+ # Get the unique_attribute name to issue along with our
+ # callback (if any)
+ unique_attr = conf.get('ldap', 'unique_attribute')
+ if unique_attr == None:
+ unique_attr = 'entryuuid'
+
+ if unique_attr == 'nsuniqueid':
+ log.warning(
+ _("The name of the persistent, unique attribute " + \
+ "is very probably not compatible with the use of " + \
+ "syncrepl.")
+ )
+
+
for uuid in uuids:
dn = self.__db[uuid]
+ log.debug("syncrepl_delete dn: %r" % (dn), level=8)
+
if not self.callback == None:
self.callback(
change_type='delete',
previous_dn=None,
change_number=None,
dn=dn,
- entry={}
+ entry={
+ unique_attr: uuid
+ }
)
del self.__db[uuid]
More information about the commits
mailing list