/[virtual-ldap]/lib/LDAP/Koha.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

Diff of /lib/LDAP/Koha.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 39 by dpavlin, Wed Mar 25 22:57:01 2009 UTC revision 40 by dpavlin, Wed Mar 25 23:23:12 2009 UTC
# Line 22  our $database = 'koha'; Line 22  our $database = 'koha';
22  our $user     = 'unconfigured-user';  our $user     = 'unconfigured-user';
23  our $passwd   = 'unconfigured-password';  our $passwd   = 'unconfigured-password';
24    
25  our $max_results = 10; # 100; # FIXME  our $max_results = 3; # 100; # FIXME
26    
27  require 'config.pl' if -e 'config.pl';  require 'config.pl' if -e 'config.pl';
28    
# Line 148  sub search { Line 148  sub search {
148    
149                          @limits = ();                          @limits = ();
150    
151                          foreach my $filter ( @{ $reqData->{'filter'}->{ $join_with } } ) {                          if ( ref $reqData->{'filter'}->{ $join_with } ) {
152                                  warn "### filter ",dump($filter),$/;  
153                                  foreach my $how ( keys %$filter ) {                                  foreach my $filter ( @{ $reqData->{'filter'}->{ $join_with } } ) {
154                                          if ( $how eq 'or' ) {                                          warn "### filter ",dump($filter),$/;
155                                                  __ldap_search_to_sql( %$_ ) foreach ( @{ $filter->{$how} } );                                          foreach my $how ( keys %$filter ) {
156                                          } else {                                                  if ( $how eq 'or' ) {
157                                                  __ldap_search_to_sql( $how, $filter->{$how} );                                                          __ldap_search_to_sql( %$_ ) foreach ( @{ $filter->{$how} } );
158                                                    } else {
159                                                            __ldap_search_to_sql( $how, $filter->{$how} );
160                                                    }
161                                                    warn "## limits ",dump(@limits), " values ",dump(@values);
162                                          }                                          }
                                         warn "## limits ",dump(@limits), " values ",dump(@values);  
163                                  }                                  }
                         }  
164    
165                          $sql_where .= ' ' . join( " $join_with ", @limits );                                  $sql_where .= ' ' . join( " $join_with ", @limits );
166    
167                            } else {
168                                    __ldap_search_to_sql( $join_with, $reqData->{'filter'}->{$join_with} );
169                            }
170    
171                  }                  }
172    
# Line 180  sub search { Line 186  sub search {
186    
187                          my $dn = 'uid=' . $row->{uid} || die "no uid";                          my $dn = 'uid=' . $row->{uid} || die "no uid";
188                          $dn =~ s{[@\.]}{,dc=}g;                          $dn =~ s{[@\.]}{,dc=}g;
189                            $dn .= ',' . $base unless $dn =~ m{dc}i;
190    
191                          my $entry = Net::LDAP::Entry->new;                          my $entry = Net::LDAP::Entry->new;
192                          $entry->dn( $dn . $base );                          $entry->dn( $dn );
193                            $entry->add( objectClass => [
194                                    "person",
195                                    "organizationalPerson",
196                                    "inetOrgPerson",
197                                    "hrEduPerson",
198                            ] );
199                          $entry->add( %$row );                          $entry->add( %$row );
200    
201                          #warn "### entry ",dump( $entry );                          #$entry->changetype( 'modify' );
202    
203                            warn "### entry ",$entry->dump( \*STDERR );
204    
205                          push @entries, $entry;                          push @entries, $entry;
206                  }                  }

Legend:
Removed from v.39  
changed lines
  Added in v.40

  ViewVC Help
Powered by ViewVC 1.1.26