/[A3C]/lib/A3C/Action/SearchLDAP.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

Annotation of /lib/A3C/Action/SearchLDAP.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 231 - (hide annotations)
Sun Aug 31 11:54:40 2008 UTC (15 years, 7 months ago) by dpavlin
File size: 1162 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 dpavlin 231 use strict;
2     use warnings;
3    
4     =head1 NAME
5    
6     A3C::Action::SearchLDAP
7    
8     =cut
9    
10     package A3C::Action::SearchLDAP;
11     use base qw/A3C::Action Jifty::Action/;
12    
13     use Jifty::Param::Schema;
14     use Jifty::Action schema {
15    
16     param base =>
17     label is _('LDAP base'),
18     default is 'dc=skole,dc=hr',
19     is mandatory;
20    
21     param filter =>
22     label is _('LDAP filter'),
23     default is '(objectClass=hrEduOrg)',
24     is mandatory;
25    
26     param sizelimit =>
27     label is _('Maximum results'),
28     default is 10,
29     available are [ 10, 50, 100, 500, 1000 ],
30     render as 'Select';
31    
32     };
33    
34     use A3C::LDAP;
35     use Data::Dump qw/dump/;
36    
37     sub sticky_on_success { 1 }
38     sub sticky_on_failure { 1 }
39    
40     =head2 take_action
41    
42     =cut
43    
44     sub take_action {
45     my $self = shift;
46    
47     if ( $self->result->success ) {
48     my $ldap = A3C::LDAP->new;
49     $ldap->search(
50     base => $self->argument_value( 'base' ),
51     filter => $self->argument_value( 'filter' ),
52     sizelimit => $self->argument_value( 'sizelimit' ),
53     );
54     $self->result->message( _('Found %1 LDAP entries', scalar $ldap->current_search->entries ) );
55     $self->result->content( 'current_search' => $ldap->current_search );
56     # } else {
57     # $self->result->error();
58     }
59    
60     return 1;
61     }
62    
63     1;
64    

  ViewVC Help
Powered by ViewVC 1.1.26