commit e0967d88df00f5bcceb8cc570eb715546ce95346 Author: Florian Best Date: Tue Aug 6 18:43:42 2019 +0200 Bug #49092: prevent extended attribute to overwrite mapping of existing properties For example, there exists a extended attribute with ldapMapping=initials and CLIName=myInitials it would overwrite the mapping. Therefore UDM doesn't have a value for that property, e.g: udm users/user list --filter uid=foo | grep -i initial initials: None myInitials: A.B. After the fix: udm users/user list --filter uid=foo | grep -i initial initials: A.B. myInitials: None Not sure if this is the best fix. It's currently not easily possible to map both. diff --git a/management/univention-directory-manager-modules/modules/univention/admin/modules.py b/management/univention-directory-manager-modules/modules/univention/admin/modules.py index 7b73ad9622..006f691ddc 100644 --- a/management/univention-directory-manager-modules/modules/univention/admin/modules.py +++ b/management/univention-directory-manager-modules/modules/univention/admin/modules.py @@ -465,10 +465,18 @@ def update_extended_attributes(lo, module, position): ) # add LDAP mapping - if attrs['univentionUDMPropertyLdapMapping'][0].lower() != 'objectClass'.lower(): - module.mapping.register(pname, attrs['univentionUDMPropertyLdapMapping'][0], unmap_method, map_method) + attribute_name = attrs['univentionUDMPropertyLdapMapping'][0] + if attribute_name.lower() != 'objectClass'.lower(): + already_existing_map_name = module.mapping.mapName(pname) + already_existing_unmap_name = module.mapping.unmapName(attribute_name) + if already_existing_map_name and already_existing_map_name != attribute_name: + pass + elif already_existing_unmap_name and already_existing_unmap_name != pname: + pass + else: + module.mapping.register(pname, attribute_name, unmap_method, map_method) else: - module.mapping.register(pname, attrs['univentionUDMPropertyLdapMapping'][0], univention.admin.mapping.nothing, univention.admin.mapping.nothing) + module.mapping.register(pname, attribute_name, univention.admin.mapping.nothing, univention.admin.mapping.nothing) if hasattr(module, 'layout'): tabname = attrs.get('univentionUDMPropertyTranslationTabName;entry-%s' % lang, attrs.get('univentionUDMPropertyLayoutTabName', [_('Custom')]))[0]