def make_ou_dn(self, entry, parent_dn): # Change from superclass: # Replace special characters with spaces instead of escaping them. # Replace multiple whitespace with a single space. strip() the result. # Add fake attributes as info to migration scripts at ny-ldap.uio.no, # which needs to undo the above hacks: '#dn' with the new DN, and # '#remove: ou' for OU values that are added by this method. new_structure_dn = self.__super.make_ou_dn( entry, self.dn2new_structure[parent_dn]) norm_new_dn = normalize_string(new_structure_dn) if norm_new_dn in self.used_new_DNs: new_structure_dn = "%s=%s+%s" % ( self.FEIDE_attr_ou_id, entry[self.FEIDE_attr_ou_id][0], new_structure_dn) self.used_new_DNs[norm_new_dn] = True entry['#dn'] = (new_structure_dn,) rdn_ou = ou_rdn2space_re.sub(' ', entry['ou'][0]).strip() entry['ou'] = self.attr_unique(entry['ou'], normalize_string) ou_count = len(entry['ou']) entry['ou'].insert(0, rdn_ou) entry['ou'] = self.attr_unique(entry['ou'], normalize_string) if len(self.attr_unique(entry['ou'], normalize_string)) > ou_count: entry['#remove: ou'] = (rdn_ou,) dn = self.__super.make_ou_dn(entry, parent_dn) self.dn2new_structure.setdefault(dn, new_structure_dn) return dn
def make_ou_dn(self, entry, parent_dn): # Change from superclass: # Replace special characters with spaces instead of escaping them. # Replace multiple whitespace with a single space. strip() the result. # Add fake attributes as info to migration scripts at ny-ldap.uio.no, # which needs to undo the above hacks: '#dn' with the new DN, and # '#remove: ou' for OU values that are added by this method. new_structure_dn = self.__super.make_ou_dn( entry, self.dn2new_structure[parent_dn]) norm_new_dn = normalize_string(new_structure_dn) if norm_new_dn in self.used_new_DNs: new_structure_dn = "%s=%s+%s" % (self.FEIDE_attr_ou_id, entry[self.FEIDE_attr_ou_id][0], new_structure_dn) self.used_new_DNs[norm_new_dn] = True entry['#dn'] = (new_structure_dn, ) rdn_ou = ou_rdn2space_re.sub(' ', entry['ou'][0]).strip() entry['ou'] = self.attr_unique(entry['ou'], normalize_string) ou_count = len(entry['ou']) entry['ou'].insert(0, rdn_ou) entry['ou'] = self.attr_unique(entry['ou'], normalize_string) if len(self.attr_unique(entry['ou'], normalize_string)) > ou_count: entry['#remove: ou'] = (rdn_ou, ) dn = self.__super.make_ou_dn(entry, parent_dn) self.dn2new_structure.setdefault(dn, new_structure_dn) return dn
def make_ou_dn(self, entry, parent_dn): # Change from superclass: # If the preferred DN is already used, include # norEduOrgUnitUniqueIdentifier in the RDN as well. dn = "ou=%s,%s" % (dn_escape_re.sub(hex_escape_match, entry['ou'][0]), parent_dn) if normalize_string(dn) in self.used_DNs: ldap_ou_id = entry['norEduOrgUnitUniqueIdentifier'][0] dn = "%s=%s+%s" % ('norEduOrgUnitUniqueIdentifier', dn_escape_re.sub(hex_escape_match, ldap_ou_id), dn) return dn
def make_ou_dn(self, entry, parent_dn): # Change from superclass: # If the preferred DN is already used, include # norEduOrgUnitUniqueIdentifier in the RDN as well. dn = "ou=%s,%s" % ( dn_escape_re.sub(hex_escape_match, entry['ou'][0]), parent_dn) if normalize_string(dn) in self.used_DNs: ldap_ou_id = entry[self.FEIDE_attr_ou_id][0] dn = "%s=%s+%s" % ( self.FEIDE_attr_ou_id, dn_escape_re.sub(hex_escape_match, ldap_ou_id), dn) return dn