svnno****@sourc*****
svnno****@sourc*****
2008年 1月 4日 (金) 01:47:28 JST
Revision: 400 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=400 Author: caesar Date: 2008-01-04 01:47:28 +0900 (Fri, 04 Jan 2008) Log Message: ----------- test ok Modified Paths: -------------- slashjp/branches/deluser/Slash/LDAPDB/lib/Slash/LDAPDB.pm -------------- next part -------------- Modified: slashjp/branches/deluser/Slash/LDAPDB/lib/Slash/LDAPDB.pm =================================================================== --- slashjp/branches/deluser/Slash/LDAPDB/lib/Slash/LDAPDB.pm 2007-12-31 07:45:28 UTC (rev 399) +++ slashjp/branches/deluser/Slash/LDAPDB/lib/Slash/LDAPDB.pm 2008-01-03 16:47:28 UTC (rev 400) @@ -34,11 +34,8 @@ our %PREFIX_KEY; @PREFIX_KEY{qw(UidNumber Passwd Email Realname)} = (); -our %keymap_s2l = (uid => 'UidNumber', passwd => 'Passwd', nickname => 'displayName', - matchname => 'cn', realname => 'Realname', realemail => 'Email' - ); +our %keymap_s2l; our %keymap_l2s; - @ keymap_l2s{@keymap_s2l{keys(%keymap_s2l)}} = keys(%keymap_s2l); # make reverse map our $DEBUG_LEVEL = 5; @@ -55,6 +52,11 @@ @_ }; bless $self, $class; + our %keymap_s2l = (uid => 'UidNumber', passwd => $constants->{ldap_attrib_prefix}.'Passwd', nickname => 'displayName', + matchname => 'cn', realname => $constants->{ldap_attrib_prefix}.'Realname', realemail => $constants->{ldap_attrib_prefix}.'Email' + ); + @keymap_l2s{@keymap_s2l{keys(%keymap_s2l)}} = keys(%keymap_s2l); # make reverse map + $DEBUG_LEVEL = $constants->{ldap_debug_level} || $DEBUG_LEVEL; if (!$self->{_disabled} && @@ -154,20 +156,18 @@ __debug(8, "LDAP::deleteUser called for user '$user'"); $self->_check_disabled and return undef; - my $userinfo = $self->getUser($user); + my $entry = $self->_get_userent("(cn=$user)"); my $mesg; - if (grep('otpUserInfo', $userinfo->{objectClass})) { + if (grep(/otpUserInfo/, $entry->get_value('objectClass'))) { __debug(8, "LDAP::deleteUser: User $user is also OTP's. The LDAP entry is only modified."); + $self->_timeout(sub { $self->{_ldap}->modify("cn=$user,$self->{base_dn}", delete => [qw(slashdotRealname)])}); $mesg = $self->_timeout(sub { $self->{_ldap}->modify("cn=$user,$self->{base_dn}", - changes => [ - delete => [ - objectClass => 'slashdotUserInfo', - 'slashdotUidNumber', - 'slashdotPassword', - 'slashdotEmail', - 'slashdotRealname' - ] - ]) }); + changes => [ + delete => [slashdotUidNumber => []], + delete => [slashdotPasswd => []], + delete => [slashdotEmail => []], + delete => [objectClass => 'slashdotUserInfo'] + ]) }); } else { $mesg = $self->_timeout(sub { $self->{_ldap}->delete("cn=${user},".$self->{base_dn}) }); }