commit 9930eb7b370fe89a98bf45a98fe40bac4193722b Author: Florian Best Date: Wed Oct 18 15:24:42 2017 +0200 Bug #16966: remove referencing policy entries diff --git a/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py b/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py index 48f3260..6dd4122 100644 --- a/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py +++ b/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py @@ -2943,6 +2943,14 @@ def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]): simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes) + def _ldap_post_remove(self): + super(simpleLdap, self)._ldap_post_remove() + for object_dn in self.lo.searchDn(filter_format('univentionPolicyReference=%s', [self.dn])): + try: + self.lo.modify(object_dn, [('univentionPolicyReference', self.dn, None)]) + except (univention.admin.uexceptions.base, ldap.LDAPError) as exc: + univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, 'Could not remove policy reference %r from %r: %s' % (self.dn, object_dn, exc)) + def copyIdentifier(self, from_object): """Activate the result mode and set the referring object"""