Changeset View
Changeset View
Standalone View
Standalone View
ucs/listener.py
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | if len(args) == 4: | ||||
command = args[4] | command = args[4] | ||||
pass | pass | ||||
elif len(args) == 3: | elif len(args) == 3: | ||||
dn = args[0] | dn = args[0] | ||||
new = utils.normalize(args[1]) | new = utils.normalize(args[1]) | ||||
old = utils.normalize(args[2]) | old = utils.normalize(args[2]) | ||||
if isinstance(old, dict) and len(old.keys()) > 0: | if isinstance(old, dict) and len(old) > 0: | ||||
# Two options: | # Two options: | ||||
# - entry changed | # - entry changed | ||||
# - entry deleted | # - entry deleted | ||||
log.info("user %r, old is dict" % (dn)) | log.info("user %r, old is dict" % (dn)) | ||||
if isinstance(new, dict) and len(new.keys()) > 0: | if isinstance(new, dict) and len(new) > 0: | ||||
log.info("Modify entry %r" % (dn)) | log.info("Modify entry %r" % (dn)) | ||||
mailserver_attribute = conf.get('ldap', 'mailserver_attribute').lower() | mailserver_attribute = conf.get('ldap', 'mailserver_attribute').lower() | ||||
if mailserver_attribute is None: | if mailserver_attribute is None: | ||||
log.error("Mail server attribute is not set") | log.error("Mail server attribute is not set") | ||||
return | return | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | elif len(args) == 3: | ||||
auth._auth._synchronize_callback( | auth._auth._synchronize_callback( | ||||
change_type='delete', | change_type='delete', | ||||
previous_dn=None, | previous_dn=None, | ||||
change_number=None, | change_number=None, | ||||
dn=dn, | dn=dn, | ||||
entry=old | entry=old | ||||
) | ) | ||||
elif isinstance(new, dict) and len(new.keys()) > 0: | elif isinstance(new, dict) and len(new) > 0: | ||||
# Old is not a dict (or empty), so the entry is just created | # Old is not a dict (or empty), so the entry is just created | ||||
log.info("Add entry %r" % (dn)) | log.info("Add entry %r" % (dn)) | ||||
# See if the mailserver_attribute exists | # See if the mailserver_attribute exists | ||||
mailserver_attribute = conf.get('ldap', 'mailserver_attribute').lower() | mailserver_attribute = conf.get('ldap', 'mailserver_attribute').lower() | ||||
if mailserver_attribute is None: | if mailserver_attribute is None: | ||||
log.error("Mail server attribute is not set") | log.error("Mail server attribute is not set") | ||||
Show All 29 Lines |