Changeset View
Changeset View
Standalone View
Standalone View
ucs/kolab_sieve.py
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | if len(args) == 4: | ||||
# moddn, not relevant for Sieve Script Management | # moddn, not relevant for Sieve Script Management | ||||
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: | ||||
# Either the entry changed or was deleted | # Either the entry changed or was deleted | ||||
if isinstance(new, dict) and len(new.keys()) > 0: | if isinstance(new, dict) and len(new) > 0: | ||||
# The entry was modified. | # The entry was modified. | ||||
result_attr = conf.get('cyrus-sasl', 'result_attribute') | result_attr = conf.get('cyrus-sasl', 'result_attribute') | ||||
if result_attr not in new: | if result_attr not in new: | ||||
log.error( | log.error( | ||||
"Entry %r does not have attribute %r" % ( | "Entry %r does not have attribute %r" % ( | ||||
dn, | dn, | ||||
Show All 31 Lines | elif len(args) == 3: | ||||
kw={'user': new[result_attr]} | kw={'user': new[result_attr]} | ||||
) | ) | ||||
else: | else: | ||||
# The entry was deleted. This is irrelevant for | # The entry was deleted. This is irrelevant for | ||||
# Sieve Script Management | # Sieve Script Management | ||||
return | return | ||||
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 | ||||
# 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() | ||||
result_attr = conf.get('cyrus-sasl', 'result_attribute').lower() | result_attr = conf.get('cyrus-sasl', 'result_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 16 Lines |