/[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 43 by dpavlin, Fri Mar 27 16:55:53 2009 UTC revision 44 by dpavlin, Wed Apr 15 11:06:27 2009 UTC
# Line 42  my $sql_select = q{ Line 42  my $sql_select = q{
42                  surname                                         as displayName,                  surname                                         as displayName,
43                  rfid_sid                                        as pager,                  rfid_sid                                        as pager,
44                  email                                           as mail,                  email                                           as mail,
45                    categorycode                                    as ou,
46                  categorycode                                    as organizationalUnit,                  categorycode                                    as organizationalUnit,
47                    categorycode                                    as memberOf,
48                    categorycode                                    as department,
49                  borrowernumber                                  as objectGUID,                  borrowernumber                                  as objectGUID,
50                  concat('/home/',borrowernumber)                 as homeDirectory                  concat('/home/',borrowernumber)                 as homeDirectory
51          from borrowers          from borrowers
# Line 96  our @limits; Line 99  our @limits;
99    
100  sub __ldap_search_to_sql {  sub __ldap_search_to_sql {
101          my ( $how, $what ) = @_;          my ( $how, $what ) = @_;
102          warn "### how $how\n";          warn "### __ldap_search_to_sql $how ",dump( $what ),"\n";
103          if ( $how eq 'equalityMatch' && defined $what ) {          if ( $how eq 'equalityMatch' && defined $what ) {
104                  my $name = $what->{attributeDesc} || warn "ERROR: no attributeDesc?";                  my $name = $what->{attributeDesc} || warn "ERROR: no attributeDesc?";
105                  my $value = $what->{assertionValue} || warn "ERROR: no assertionValue?";                  my $value = $what->{assertionValue} || warn "ERROR: no assertionValue?";
106                  if ( ! $ldap_ignore->{ $name } ) {                  if ( ! $ldap_ignore->{ $name } ) {
107                          push @limits, __sql_column($name) . ' = ?';                          push @limits, __sql_column($name) . ' = ?';
108                          push @values, $value;                          push @values, $value;
109                    } else {
110                            warn "IGNORED: $name = $value";
111                  }                  }
112          } elsif ( $how eq 'substrings' ) {          } elsif ( $how eq 'substrings' ) {
113                  foreach my $substring ( @{ $what->{substrings} } ) {                  foreach my $substring ( @{ $what->{substrings} } ) {
# Line 122  sub __ldap_search_to_sql { Line 127  sub __ldap_search_to_sql {
127                  push @limits, "$name IS NOT NULL and length($name) > 1";                  push @limits, "$name IS NOT NULL and length($name) > 1";
128                  ## XXX length(foo) > 1 to avoid empty " " strings                  ## XXX length(foo) > 1 to avoid empty " " strings
129          } else {          } else {
130                  warn "UNSUPPORTED: how $how what ",dump( $what );                  warn "UNSUPPORTED: $how ",dump( $what );
131          }          }
132  }  }
133    
# Line 144  sub search { Line 149  sub search {
149    
150                  foreach my $join_with ( keys %{ $reqData->{'filter'} } ) {                  foreach my $join_with ( keys %{ $reqData->{'filter'} } ) {
151    
152                          warn "## join_with $join_with\n";                          warn "## join_with $join_with ", dump( $reqData->{'filter'}->{ $join_with } ), "\n";
153    
154                          @limits = ();                          @limits = ();
155    
156                          if ( ref $reqData->{'filter'}->{ $join_with } ) {                          if ( ref $reqData->{'filter'}->{ $join_with } eq 'ARRAY' ) {
157    
158                                  foreach my $filter ( @{ $reqData->{'filter'}->{ $join_with } } ) {                                  foreach my $filter ( @{ $reqData->{'filter'}->{ $join_with } } ) {
159                                          warn "### filter ",dump($filter),$/;                                          warn "### filter ",dump($filter),$/;
# Line 174  sub search { Line 179  sub search {
179                          $sql_where = " where $sql_where";                          $sql_where = " where $sql_where";
180                  }                  }
181    
182                  warn "# SQL:\n$sql_select $sql_where\n# DATA: ",dump( @values );                  warn "# SQL:\n$sql_select\n$sql_where\n# DATA: ",dump( @values );
183                  my $sth = $dbh->prepare( $sql_select . $sql_where . " LIMIT $max_results" ); # XXX remove limit?                  my $sth = $dbh->prepare( $sql_select . $sql_where . " LIMIT $max_results" ); # XXX remove limit?
184                  $sth->execute( @values );                  $sth->execute( @values );
185    

Legend:
Removed from v.43  
changed lines
  Added in v.44

  ViewVC Help
Powered by ViewVC 1.1.26