Project

General

Profile

Enhancement #22 » activeldap_rename_partial.patch

Marc Dequènes, 2010-08-13 12:36

View differences:

./base.rb 2010-08-13 12:11:13.000000000 +0200
1573 1573
      prepare_data_for_saving do |data, ldap_data|
1574 1574
        new_dn_value, attributes = collect_modified_attributes(ldap_data, data)
1575 1575
        modify_entry(@original_dn, attributes)
1576
        if new_dn_value
1576
        if new_dn_value or @dn.to_s != @original_dn
1577 1577
          old_dn_base = DN.parse(@original_dn).parent
1578 1578
          new_dn_base = dn.clone.parent
1579
          if new_dn_value
1580
            rdn = "#{dn_attribute}=#{DN.escape_value(new_dn_value)}"
1581
          else
1582
            rdn = DistinguishedName.new(@dn.rdns.first).to_s
1583
          end
1584

  
1579 1585
          if old_dn_base == new_dn_base
1580 1586
            new_superior = nil
1581 1587
          else
1582 1588
            new_superior = new_dn_base
1583 1589
          end
1584 1590
          modify_rdn_entry(@original_dn,
1585
                           "#{dn_attribute}=#{DN.escape_value(new_dn_value)}",
1591
                           rdn,
1586 1592
                           true,
1587 1593
                           new_superior)
1588 1594
        end
    (1-1/1)