Change sn when modifying user
authorJamie Cameron <jcameron@webmin.com>
Wed, 14 Oct 2009 18:01:01 +0000 (11:01 -0700)
committerJamie Cameron <jcameron@webmin.com>
Wed, 14 Oct 2009 18:01:01 +0000 (11:01 -0700)
ldap-useradmin/CHANGELOG
ldap-useradmin/ldap-useradmin-lib.pl

index 3ae89ac..6c1ff03 100644 (file)
@@ -66,3 +66,6 @@ Added a Module Config option to allow / as an IMAP folder separator, thanks to B
 Added a check on the module's main page to ensure that the LDAP schema is accessible.
 Fixed support for SSL and TLS when connecting to the LDAP server, thanks to Paul R. Ganci.
 Added a Module Config option to use a text box for entering secondary group members, rather than the left/right user chooser.
+---- Changes since 1.490 ----
+Improve the user and group rename code to not move the DN to be under the global base if not needed.
+Modifying a user now correctly changes the sn attribute too.
index 61c7998..da241e4 100755 (executable)
@@ -245,6 +245,11 @@ push(@attrs, @{$_[1]->{'ldap_attrs'}});
 if (defined($_[1]->{'ldap_class'})) {
        push(@attrs, "objectClass" => $_[1]->{'ldap_class'});
        }
+if (&indexoflc("person", @{$_[1]->{'ldap_class'}}) >= 0 &&
+    !&in_props(\@attrs, "sn")) {
+       # Person needs 'sn'
+       push(@attrs, "sn", &in_props(\@attrs, "cn"));
+       }
 local %replace;
 for(my $i=0; $i<@attrs; $i+=2) {
        $replace{$attrs[$i]} ||= [ ];