109 |
'Organization', |
'Organization', |
110 |
# optional params |
# optional params |
111 |
limit => $limit, |
limit => $limit, |
112 |
|
filter => '(uid=foobar)', |
113 |
); |
); |
114 |
|
|
115 |
=cut |
=cut |
116 |
|
|
117 |
my $collection2filter = { |
my $collection2filter = { |
118 |
'User' => '(objectClass=hrEduPerson)', |
'Person' => '(objectClass=hrEduPerson)', |
119 |
'Organization' => '(objectClass=hrEduOrg)', |
'Organization' => '(objectClass=hrEduOrg)', |
120 |
}; |
}; |
121 |
|
|
129 |
my $filter = $collection2filter->{$model}; |
my $filter = $collection2filter->{$model}; |
130 |
die "unknown model $model" unless $filter; |
die "unknown model $model" unless $filter; |
131 |
|
|
132 |
|
# add user filter |
133 |
|
$filter = '(&' . $filter . $args->{filter} . ')' if $args->{filter}; |
134 |
|
|
135 |
$self->search( |
$self->search( |
136 |
base => $self->base, |
base => $self->base, |
137 |
filter => $filter, |
filter => $filter, |
139 |
); |
); |
140 |
|
|
141 |
Jifty->log->info( |
Jifty->log->info( |
142 |
"searching LDAP for $model with $filter ", |
"Searching LDAP for $model with $filter ", |
143 |
$args->{limit} ? 'limit ' . $args->{limit} : '', |
$args->{limit} ? 'limit ' . $args->{limit} . ' ' : '', |
144 |
'returned ', $self->count, ' results' |
'returned ', $self->count, ' results' |
145 |
); |
); |
146 |
|
|
151 |
my $model_obj = Jifty->app_class('Model',$model)->new; |
my $model_obj = Jifty->app_class('Model',$model)->new; |
152 |
#warn dump( $model_obj ); |
#warn dump( $model_obj ); |
153 |
my $additional; |
my $additional; |
|
# if ( $model eq 'User' ) { |
|
|
# my $organization = A3C::Model::Organization->new; |
|
|
# $self->ldap2model( $organization, $entry ); |
|
|
# $additional->{organization} = $organization; |
|
|
# } |
|
154 |
$self->ldap2model( $model_obj, $entry, %$additional ); |
$self->ldap2model( $model_obj, $entry, %$additional ); |
155 |
$collection->add_record( $model_obj ); |
$collection->add_record( $model_obj ); |
156 |
} |
} |