/[A3C]/lib/A3C/View/LDAP.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /lib/A3C/View/LDAP.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 231 - (show annotations)
Sun Aug 31 11:54:40 2008 UTC (15 years, 7 months ago) by dpavlin
File size: 1378 byte(s)
Added action SearchLDAP which replace old dump and enables us to issue
search requests directly to upstream LDAP to check it's current data
1 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 use Encode qw/decode/;
47
48 template 'search' => page {
49 h1 { _('LDAP data about Schools in system') };
50
51 my $action = new_action(
52 class => 'SearchLDAP',
53 moniker => 'search-ldap'
54 );
55
56 form {
57 render_action( $action => [ 'base', 'filter', 'sizelimit' ] );
58 form_submit( label => _('Search LDAP') );
59 };
60
61 if ( my $search = $action->result->content( 'current_search' ) ) {
62 div {
63 while ( my $entry = $search->shift_entry ) {
64 #warn $entry->dump;
65 ul {
66 foreach my $attr ( $entry->attributes ) {
67 li {
68 tt { $attr }
69 my $vals = decode('utf-8', join('<b>&bull;</b>', $entry->get_value( $attr ) ));
70 span { outs_raw( $vals ) }
71 }
72 }
73 }
74 }
75 }
76 }
77 };
78
79
80

  ViewVC Help
Powered by ViewVC 1.1.26