1 |
dpavlin |
209 |
package A3C::View::LDAP; |
2 |
|
|
|
3 |
|
|
=head1 NAME |
4 |
|
|
|
5 |
|
|
A3C::View::LDAP |
6 |
|
|
|
7 |
|
|
=head1 DESCRIPTION |
8 |
|
|
|
9 |
|
|
Provide LDAP interface |
10 |
|
|
|
11 |
|
|
=cut |
12 |
|
|
|
13 |
|
|
use strict; |
14 |
|
|
use warnings; |
15 |
|
|
|
16 |
|
|
use Jifty::View::Declare -base; |
17 |
|
|
use Data::Dump qw/dump/; |
18 |
|
|
|
19 |
|
|
template 'sync' => page { |
20 |
|
|
|
21 |
|
|
h1 { _('Sync school from LDAP') } |
22 |
|
|
|
23 |
|
|
my $action = new_action( |
24 |
|
|
class => 'SyncOrganization', |
25 |
|
|
moniker => 'sync-organization' |
26 |
|
|
); |
27 |
|
|
|
28 |
|
|
form { |
29 |
|
|
render_action( $action => [ 'org_uid' ] ); |
30 |
|
|
form_submit( label => _('Sync Organization') ); |
31 |
|
|
}; |
32 |
|
|
|
33 |
|
|
if ( my $users = $action->result->content('synced-users') ) { |
34 |
|
|
ol { |
35 |
|
|
while (my $user = $users->next) { |
36 |
|
|
li { |
37 |
|
|
span { $user->cn } |
38 |
|
|
tt { { class is 'email' } '<' . $user->mail . '>' } |
39 |
|
|
} |
40 |
|
|
} |
41 |
|
|
} |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
}; |
45 |
|
|
|
46 |
|
|
|
47 |
|
|
template 'dump' => page { |
48 |
|
|
h1 { _('LDAP data about Schools in system') }; |
49 |
|
|
my $ldap = A3C::LDAP->new; |
50 |
|
|
div { |
51 |
|
|
$ldap->search( |
52 |
|
|
base => 'dc=skole,dc=hr', |
53 |
|
|
filter => '(objectClass=hrEduOrg)', |
54 |
|
|
sizelimit => 10, |
55 |
|
|
); |
56 |
|
|
while ( my $entry = $ldap->current_search->shift_entry ) { |
57 |
|
|
#warn $entry->dump; |
58 |
|
|
ul { |
59 |
|
|
foreach my $attr ( $entry->attributes ) { |
60 |
|
|
li { |
61 |
|
|
tt { $attr } |
62 |
|
|
span { dump( $entry->get_value( $attr ) ) } |
63 |
|
|
} |
64 |
|
|
} |
65 |
|
|
} |
66 |
|
|
} |
67 |
|
|
} |
68 |
|
|
}; |
69 |
|
|
|
70 |
|
|
|
71 |
|
|
|