Browse Source

* LDV::LDAP->update : finished, but not tested

master
Alex 'AdUser' Z 10 years ago
parent
commit
5fad7ef128
  1. 13
      lib/LDV/LDAP.pm

13
lib/LDV/LDAP.pm

@ -109,10 +109,14 @@ sub update {
unless ($data);
my $dn = sprintf "uid=%s,%s", $uid, $self->{userbase};
foreach my $key (keys($attrs)) {
...
while (my ($key, $value) = each(%$attrs)) {
next if ($value and exists $data->{$key});
delete $attrs->{$key};
}
my $result = $conn->modify($dn, replace => $attrs);
$conn->unbind;
return $result->error if ($result->code);
return;
}
@ -160,7 +164,10 @@ Get user attributes. Returns HASH on success or undef if not found.
=head2 C<update>
my $ldap = LDV::LDAP->new(\%opts);
my $err = $ldap->update($user, \%attrs);
TODO
Returns nothing on success or scalar with text on error.
Each key in %attrs must exists for this user's entry.
Empty values will be silently skipped.
=cut

Loading…
Cancel
Save