diff --git a/services/univention-ad-connector/modules/univention/connector/__init__.py b/services/univention-ad-connector/modules/univention/connector/__init__.py index 8518864eb5..d4ae93b60d 100644 --- a/services/univention-ad-connector/modules/univention/connector/__init__.py +++ b/services/univention-ad-connector/modules/univention/connector/__init__.py @@ -326,11 +326,12 @@ class configsaver: class attribute: - def __init__(self, ucs_attribute='', ldap_attribute='', con_attribute='', con_other_attribute='', required=0, single_value=False, compare_function='', con_value_merge_function='', mapping=(), reverse_attribute_check=False, sync_mode='sync'): + def __init__(self, ucs_attribute='', ldap_attribute='', con_attribute='', con_other_attribute='', required=0, single_value=False, compare_function='', con_value_merge_function='', mapping=(), reverse_attribute_check=False, sync_mode='sync', con_depends=''): self.ucs_attribute = ucs_attribute self.ldap_attribute = ldap_attribute self.con_attribute = con_attribute self.con_other_attribute = con_other_attribute + self.con_depends = con_depends self.required = required self.compare_function = compare_function self.con_value_merge_function = con_value_merge_function @@ -1095,7 +1096,8 @@ class ucs: changed_attributes = object.get('changed_attributes', []) changed = not changed_attributes or \ attribute.con_attribute in changed_attributes or \ - attribute.con_other_attribute in changed_attributes + attribute.con_other_attribute in changed_attributes or \ + attribute.con_depends in changed_attributes if changed: ud.debug(ud.LDAP, ud.INFO, @@ -1115,7 +1117,8 @@ class ucs: changed_attributes = object.get('changed_attributes', []) changed = not changed_attributes or \ attribute.con_attribute in changed_attributes or \ - attribute.con_other_attribute in changed_attributes + attribute.con_other_attribute in changed_attributes or \ + attribute.con_depends in changed_attributes if changed: ud.debug(ud.LDAP, ud.INFO, diff --git a/services/univention-ad-connector/modules/univention/connector/ad/__init__.py b/services/univention-ad-connector/modules/univention/connector/ad/__init__.py index 9236a6f5a6..30d17774ba 100644 --- a/services/univention-ad-connector/modules/univention/connector/ad/__init__.py +++ b/services/univention-ad-connector/modules/univention/connector/ad/__init__.py @@ -994,6 +994,15 @@ class ad(univention.connector.ucs): if not getattr(attr, 'con_other_attribute') and attr.con_attribute in self.single_valued_ad_attributes: attr.single_value = True + for mapping_key, mapping_property in self.property.items(): + for attr_type in ('attributes', 'post_attributes'): + con_attributes = getattr(mapping_property, attr_type) + if not con_attributes: + continue + for attr_key, attr in con_attributes.items(): + if attr.ldap_attribute == 'mailPrimaryAddress': + attr.con_depends = 'mail' + # Log the active mapping if ud.get_level(ud.LDAP) >= ud.INFO: mapping_lines = ["Mapping:"]