Skip to content

Commit

Permalink
Item14276: properly detect users in all DNs
Browse files Browse the repository at this point in the history
... configured in UserBase
  • Loading branch information
MichaelDaum committed Jan 16, 2017
1 parent 9e06492 commit bc658ab
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
4 changes: 3 additions & 1 deletion data/System/LdapNgPlugin.txt
Expand Up @@ -158,6 +158,8 @@ implements a fast solr-based person search with a different =SolrWikiUsersView=
%$DEPENDENCIES%

---++ Change History
%TABLE{columnwidths="7em" tablewidth="100%"}%
| 16 Jan 2017: | fix querying for users at all of the DNs configured in ={<nop>UserBase}= |
| 02 Sep 2016: | added =nullformat= parameter to %LDAP macro |
| 23 May 2016: | added =value_separator= to fetch multi-value attributes from LDAP |
| 31 Aug 2015: | added support to index profile images stored in LDAP and indexed in Solr |
Expand Down Expand Up @@ -194,7 +196,7 @@ implements a fast solr-based person search with a different =SolrWikiUsersView=

%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="Michael Daum"}%
%META:FIELD{name="Copyright" title="Copyright" value="2006-2016 Michael Daum http://michaeldaumconsulting.com"}%
%META:FIELD{name="Copyright" title="Copyright" value="2006-2017 Michael Daum http://michaeldaumconsulting.com"}%
%META:FIELD{name="Description" title="Description" value="%25$SHORTDESCRIPTION%25"}%
%META:FIELD{name="Home" title="Home" value="Foswiki:Extensions/%TOPIC%"}%
%META:FIELD{name="License" title="License" value="GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]])"}%
Expand Down
6 changes: 3 additions & 3 deletions lib/Foswiki/Plugins/LdapNgPlugin.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2006-2016 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2006-2017 Michael Daum http://michaeldaumconsulting.com
# Portions Copyright (C) 2006 Spanlink Communications
#
# This program is free software; you can redistribute it and/or
Expand All @@ -19,8 +19,8 @@ use strict;
use warnings;

our $core;
our $VERSION = '6.30';
our $RELEASE = '02 Sep 2016';
our $VERSION = '6.40';
our $RELEASE = '16 Jan 2017';
our $NO_PREFS_IN_TOPIC = 1;
our $SHORTDESCRIPTION = 'Query and display data from an LDAP directory';

Expand Down
28 changes: 17 additions & 11 deletions lib/Foswiki/Plugins/LdapNgPlugin/Core.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2006-2016 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2006-2017 Michael Daum http://michaeldaumconsulting.com
# Portions Copyright (C) 2006 Spanlink Communications
#
# This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -415,16 +415,22 @@ sub indexTopicHandler {
#print STDERR "filter='$filter'\n";
my $entry;

my $search = $ldap->search(
filter => $filter,
limit => 1,
attrs => [ keys %$personAttributes ],
callback => sub {
my (undef, $result) = @_;
return unless defined $result;
$entry = $result;
},
);
foreach my $userBase (@{$ldap->{userBase}}) {
my $msg = $ldap->search(
filter => $filter,
limit => 1,
base => $userBase,
deref => "always",
attrs => [ keys %$personAttributes ],
callback => sub {
my (undef, $result) = @_;
return unless defined $result;
$entry = $result;
}
);

last if $entry;
}

unless ($entry) {
#print STDERR "$loginName not found in LDAP directory\n";
Expand Down

0 comments on commit bc658ab

Please sign in to comment.