| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::LDAP::Command::Export; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use Modern::Perl; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
498
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
with qw( App::LDAP::Role::Command |
|
8
|
|
|
|
|
|
|
App::LDAP::Role::Bindable ); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has base => ( |
|
11
|
|
|
|
|
|
|
is => "rw", |
|
12
|
|
|
|
|
|
|
isa => "Str", |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has scope => ( |
|
16
|
|
|
|
|
|
|
is => "rw", |
|
17
|
|
|
|
|
|
|
isa => "Str", |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has filter => ( |
|
21
|
|
|
|
|
|
|
is => "rw", |
|
22
|
|
|
|
|
|
|
isa => "Str", |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub run { |
|
26
|
|
|
|
|
|
|
my ($self) = shift; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $file = $self->extra_argv->[1]; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
if (! defined($file)) { |
|
31
|
|
|
|
|
|
|
say "you must give the file name to export"; |
|
32
|
|
|
|
|
|
|
exit; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my @entries = ldap()->search( |
|
36
|
|
|
|
|
|
|
base => $self->base // config()->{base}, |
|
37
|
|
|
|
|
|
|
scope => $self->scope // config()->{scope}, |
|
38
|
|
|
|
|
|
|
filter => $self->filter // "objectClass=*", |
|
39
|
|
|
|
|
|
|
)->entries; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
open my $output, ">", $file or die "can not open $file"; |
|
43
|
|
|
|
|
|
|
for (@entries) { |
|
44
|
|
|
|
|
|
|
print $output $_->ldif; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
51
|
|
|
|
|
|
|
no Moose; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
App::LDAP::Command::Export |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
$ sudo ldap export backup.ldif |
|
62
|
|
|
|
|
|
|
backup whole DIT |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
$ ldap export people.ldif --base ou=people,dc=example,dc=com |
|
65
|
|
|
|
|
|
|
dump user information without password |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$ sudo ldap export people.ldif --base ou=people,dc=example,dc=com |
|
68
|
|
|
|
|
|
|
dump user information with password |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |