--- lib/A3C/LDAP.pm 2008/03/31 21:11:45 47 +++ lib/A3C/LDAP.pm 2008/04/09 23:14:47 66 @@ -109,12 +109,13 @@ 'Organization', # optional params limit => $limit, + filter => '(uid=foobar)', ); =cut my $collection2filter = { - 'User' => '(objectClass=hrEduPerson)', + 'Person' => '(objectClass=hrEduPerson)', 'Organization' => '(objectClass=hrEduOrg)', }; @@ -128,6 +129,9 @@ my $filter = $collection2filter->{$model}; die "unknown model $model" unless $filter; + # add user filter + $filter = '(&' . $filter . $args->{filter} . ')' if $args->{filter}; + $self->search( base => $self->base, filter => $filter, @@ -135,8 +139,8 @@ ); Jifty->log->info( - "searching LDAP for $model with $filter ", - $args->{limit} ? 'limit ' . $args->{limit} : '', + "Searching LDAP for $model with $filter ", + $args->{limit} ? 'limit ' . $args->{limit} . ' ' : '', 'returned ', $self->count, ' results' ); @@ -147,11 +151,6 @@ my $model_obj = Jifty->app_class('Model',$model)->new; #warn dump( $model_obj ); my $additional; -# if ( $model eq 'User' ) { -# my $organization = A3C::Model::Organization->new; -# $self->ldap2model( $organization, $entry ); -# $additional->{organization} = $organization; -# } $self->ldap2model( $model_obj, $entry, %$additional ); $collection->add_record( $model_obj ); }