Commit 58742087 authored by Benjamin Fischer's avatar Benjamin Fischer

[extension/ldap_export] fixed ldap3 API usage

parent 1a84ad40
......@@ -50,16 +50,16 @@ class LDAPExport(object):
self.connection.search(self.user_base, "(objectClass=posixAccount)", attributes=['uid'])
for ldap_user in self.connection.entries:
if ldap_user.uid not in active_users:
logger.info("Deleting unknown ldap user: %s", ldap_user.entry_get_dn())
self.connection.delete(ldap_user.entry_get_dn())
logger.info("Deleting unknown ldap user: %s", ldap_user.entry_dn)
self.connection.delete(ldap_user.entry_dn)
self.connection.search(self.group_base, "(objectClass=posixGroup)", attributes=['cn'])
for ldap_group in self.connection.entries:
private_group = self.private_group and ldap_group.cn in active_users
public_group = ldap_group.cn in groups
if not private_group and not public_group:
logger.info("Deleting unknown ldap group: %s", ldap_group.entry_get_dn())
self.connection.delete(ldap_group.entry_get_dn())
logger.info("Deleting unknown ldap group: %s", ldap_group.entry_dn)
self.connection.delete(ldap_group.entry_dn)
except:
logger.exception("remove_invalid_ldap_entries")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment