9 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
10 |
|
|
11 |
|
|
12 |
template '/skole' => page { |
template 'ldap' => page { |
13 |
h1 { _('Schools in system') }; |
h1 { _('LDAP data about Schools in system') }; |
|
show 'skole_sve'; |
|
|
}; |
|
|
|
|
|
private template 'skole_sve' => sub { |
|
14 |
my $ldap = A3C::LDAP->new; |
my $ldap = A3C::LDAP->new; |
15 |
div { |
div { |
16 |
$ldap->search( |
$ldap->search( |
32 |
} |
} |
33 |
}; |
}; |
34 |
|
|
35 |
|
template 'people' => page { |
36 |
|
|
37 |
|
h1 { _('Find people') } |
38 |
|
|
39 |
|
my $action = new_action( |
40 |
|
class => 'SearchPerson', |
41 |
|
moniker => 'search-users', |
42 |
|
sticky_on_success => 1, |
43 |
|
sticky_on_failure => 1, |
44 |
|
); |
45 |
|
|
46 |
|
|
47 |
|
form { |
48 |
|
render_action( $action => [ 'uid_contains', 'cn_contains' ] ); |
49 |
|
form_submit( label => _('Find someone') ); |
50 |
|
}; |
51 |
|
|
52 |
|
# warn dump( $action->result->content ); |
53 |
|
|
54 |
|
if ( my $search = $action->result->content('search') ) { |
55 |
|
div { sprintf(_('Found %d results'), $search->count ) } |
56 |
|
ol { |
57 |
|
while (my $user = $search->next) { |
58 |
|
li { |
59 |
|
span { $user->cn } |
60 |
|
tt { $user->uid } |
61 |
|
} |
62 |
|
} |
63 |
|
} |
64 |
|
} |
65 |
|
|
66 |
|
}; |
67 |
|
|
68 |
|
template 'sync' => page { |
69 |
|
|
70 |
|
h1 { _('Sync school from LDAP') } |
71 |
|
|
72 |
|
my $action = new_action( |
73 |
|
class => 'SyncOrganization', |
74 |
|
moniker => 'sync-organization' |
75 |
|
); |
76 |
|
|
77 |
|
form { |
78 |
|
render_action( $action => [ 'cn' ] ); |
79 |
|
form_submit( label => _('Sync Organization') ); |
80 |
|
}; |
81 |
|
|
82 |
|
if ( my $users = $action->result->content('synced-users') ) { |
83 |
|
ol { |
84 |
|
while (my $user = $users->next) { |
85 |
|
li { |
86 |
|
span { $user->cn } |
87 |
|
tt { { class is 'email' } '<' . $user->mail . '>' } |
88 |
|
} |
89 |
|
} |
90 |
|
} |
91 |
|
} |
92 |
|
|
93 |
|
}; |