|
|
@ -62,28 +62,8 @@ sub create { |
|
|
|
sn => 'just', |
|
|
|
sn => 'just', |
|
|
|
cn => 'created', |
|
|
|
cn => 'created', |
|
|
|
]); |
|
|
|
]); |
|
|
|
return $result->error if ($result->code); |
|
|
|
|
|
|
|
$conn->unbind; |
|
|
|
$conn->unbind; |
|
|
|
return; |
|
|
|
return $result->error if ($result->code); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub update { |
|
|
|
|
|
|
|
my ($self, $uid, $attrs) = @_; |
|
|
|
|
|
|
|
return "Attrs isn't HASH" |
|
|
|
|
|
|
|
if (ref($attrs) ne 'HASH'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $conn = $self->_connect(); |
|
|
|
|
|
|
|
$uid = $self->_escape($uid); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $data = $self->get($uid); |
|
|
|
|
|
|
|
return "No such user" |
|
|
|
|
|
|
|
unless ($data); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $dn = sprintf "uid=%s,%s", $uid, $self->{userbase}; |
|
|
|
|
|
|
|
foreach my $key (keys($attrs)) { |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -94,6 +74,7 @@ sub delete { |
|
|
|
my $dn = sprintf "uid=%s,%s", $uid, $self->{userbase}; |
|
|
|
my $dn = sprintf "uid=%s,%s", $uid, $self->{userbase}; |
|
|
|
my $result = $conn->delete($dn); |
|
|
|
my $result = $conn->delete($dn); |
|
|
|
$conn->unbind; |
|
|
|
$conn->unbind; |
|
|
|
|
|
|
|
return $result->error if ($result->code); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -115,4 +96,24 @@ sub get { |
|
|
|
return $data; |
|
|
|
return $data; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub update { |
|
|
|
|
|
|
|
my ($self, $uid, $attrs) = @_; |
|
|
|
|
|
|
|
return "Attrs isn't HASH" |
|
|
|
|
|
|
|
if (ref($attrs) ne 'HASH'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $conn = $self->_connect(); |
|
|
|
|
|
|
|
$uid = $self->_escape($uid); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $data = $self->get($uid); |
|
|
|
|
|
|
|
return "No such user" |
|
|
|
|
|
|
|
unless ($data); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $dn = sprintf "uid=%s,%s", $uid, $self->{userbase}; |
|
|
|
|
|
|
|
foreach my $key (keys($attrs)) { |
|
|
|
|
|
|
|
... |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
1; |
|
|
|
1; |
|
|
|