Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://svn.foswiki.org/trunk/LdapNgPlugin@1882 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
- Loading branch information
MichaelDaum
authored and
MichaelDaum
committed
Jan 8, 2009
1 parent
185540e
commit 021f150
Showing
7 changed files
with
510 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
%META:TOPICINFO{author="ProjectContributor" date="1167752717" format="1.1" version="$Rev: 1801 $"}% | ||
---+!! <nop>%TOPIC% | ||
<!-- | ||
|
||
PLEASE DO NOT EDIT THIS TOPIC | ||
|
||
It is automatically generated from the subversion repository, and any changes | ||
you make will simply be overwritten the next time a release is generated. | ||
|
||
Instead, you could check your fix in, raise a bug in the Bugs web, or mail the author. | ||
--> | ||
%TOC% | ||
<table style="float:right"> | ||
<tr> | ||
<td><img src="%ATTACHURLPATH%/wikiringlogo40x40.png"></td> | ||
<td><a href="http://wikiring.com" title="Make your Wiki ring!" style="text-decoration:none"> | ||
Powered by <br /> <nop>WikiRing Consultants </a> | ||
</td> | ||
</tr> | ||
</table> | ||
This plugin provides an interface to query an LDAP directory and display the results in a <nop>WikiApplication | ||
It is a complete rewrite of the Foswiki:Extensions/LdapPlugin by Gerard Hickey to provide | ||
greater flexibility and performance based on the Foswiki:Extensions/LdapContrib package. | ||
|
||
---++ Syntax Rules | ||
---+++ LDAP | ||
<verbatim>%LDAP{(filter=)"filter" ...}%</verbatim> | ||
Query an LDAP directrory. | ||
|
||
Parameters: | ||
* =filter=: the LDAP query string | ||
* =host=: host IP or name to connect to | ||
* =port=: port to of the host | ||
* =version=: protocol version; possible values: 2,3 | ||
* =ssl=: use ssl to bind to the server; possible values 0,1 | ||
* =base=: base dn of the (sub)tree to search in; | ||
if =base= is written in brackets (e.g. 'base="(ou=people)"') then it is prepended to the default | ||
base of the LdapContrib | ||
* =scope=: scope of search; possible values: sub, base, one | ||
* =format=: format string used to display a database record | ||
* =header=: header to prepend the output; default: '$dn' | ||
* =footer=: footer to appended to the output | ||
* =sep=: separator between database records; default: '$n' | ||
* =sort=: name of attributes to sort the output | ||
* =reverse=: reverse the result set; possible values: on, off; default: off | ||
* =limit=: maximum number of records to return; default: 0 (unlimited) | ||
* =skip=: number of records in the hit set to skip before displaying them; default: 0 | ||
* =hidenull=: wether to hide any output on an empty hit set; possible values: on, off; default: off | ||
* =clear=: comma separated list of attributes to be removed from the output if they are not resolved | ||
|
||
Cgi Parameters: | ||
* =refresh=: refresh the cache of blobs (i.e. jpegPhotos); possible values: on, off; default: off; | ||
(right now only the jpegPhoto attribute is recognized as a blob) | ||
|
||
The =header=, =format= and =footer= format strings may contain the following variables: | ||
* $percnt: % sign | ||
* $dollar: $ sign | ||
* $n: newline | ||
* $count: the number of hits | ||
* $index: the record number | ||
* $<attr-name>: the value of the record attribute <attr-name> | ||
|
||
---+++ LDAPUSERS | ||
<verbatim>%LDAPUSERS{...}%</verbatim> | ||
List all LDAP userinformation. Information is drawn from cache and not from | ||
the LDAP server. Use =?refreshldap=on= to update. | ||
|
||
Parameters: | ||
* =format=: format string used to display a user record | ||
* =header=: header to prepend the output | ||
* =footer=: footer to appended to the output | ||
* =sep=: separator between database records; default: '$n' | ||
* =limit=: maximum number of records to return; default: 0 (unlimited) | ||
* =skip=: number of records in the hit set to skip before displaying them; default: 0 | ||
* =include=: regular expression a user's <nop>WikiName must match to be included in the output | ||
* =exclude=: regular expression a user's <nop>WikiName must not match | ||
* =hideunknown=: on/off, enable/disable filtering out users that did not log in yet and thus | ||
have no hometopic (e.g. created by Foswiki:Extensions/NewUsersPlugin), defaults to 'on' | ||
|
||
The =format= string may contain the following variables: | ||
* $percnt: % sign | ||
* $dollar: $ sign | ||
* $n: newline | ||
* $index: the record number | ||
* $wikiName: the user's <nop>WikiName | ||
* $loginName: the user's login name | ||
* $displayName: a link pointing to the users hometopic in the %MAINWEB% web, if it exists, and | ||
'<nop>$wikiName' otherwise | ||
* $emails: the list of all known email addresses | ||
|
||
---++ Examples | ||
%LDAP{"(objectClass=posixAccount)" | ||
base="(ou=people)" | ||
limit="10" | ||
header="| *Nr* | *Name* | *Mail* | *Photo* |$n" | ||
format="| $index | $cn | $mail | <img src=\"$jpegPhoto\" alt=\"$cn\" title=\"$cn\" width=\"100px\"> |" | ||
footer="$n<br/><font color='red'>$count users</font>" | ||
sort="cn" | ||
clear="$mail,$jpegPhoto" | ||
}% | ||
|
||
%LDAP{"(objectClass=posixGroup)" | ||
base="(ou=group)" | ||
limit="10" | ||
header="| *Nr* | *Group* | *Members* |$n" | ||
format="| $index | $cn | $memberUid |" | ||
clear="$mail,$memberUid" | ||
sort="cn" | ||
}% | ||
|
||
%LDAPUSERS{limit="10"}% | ||
|
||
---++ Plugin Settings | ||
<!-- provided for compatibility only | ||
* Set SHORTDESCRIPTION = Query and display data from an LDAP directory | ||
--> | ||
|
||
The %TOPIC% will use the default configuration of the LdapContrib in your =LocalSite.cfg= file, that is | ||
* $Foswiki::cfg{Ldap}{Host} (overridable per query) | ||
* $Foswiki::cfg{Ldap}{Port} (overridable per query) | ||
* $Foswiki::cfg{Ldap}{Base} (overridable per query) | ||
* $Foswiki::cfg{Ldap}{Version} (overridable per query) | ||
* $Foswiki::cfg{Ldap}{SSL} (overridable per query) | ||
* $Foswiki::cfg{Ldap}{BindDN} | ||
* $Foswiki::cfg{Ldap}{BindPasswd} | ||
|
||
---++ Plugin Installation Instructions | ||
%$INSTALL_INSTRUCTIONS% | ||
%$DEPENDENCIES% | ||
|
||
---++ Plugin Info | ||
This work was partly funded by Spanlink Communications. | ||
| Plugin Author: | Michael Daum | | ||
| Copyright ©: | 2006-2009 Michael Daum http://michaeldaumconsulting.com | | ||
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | | ||
| Plugin Version: | v2.03 | | ||
| Change History: | | | ||
| 08 Jan 2009: | ported to foswiki | | ||
| 12 Jun 2008: | fixed yet another "sep" problem | | ||
| 13 Nov 2007: | fixed $nop | | ||
| 01 Oct 2007: | added LDAPUSERS, lined up to changes in <nop>LdapContrib-2.0 | | ||
| 04 June 2007: | don't convert from/to utf8 if the site charset is already utf8 | | ||
| 18 Dec 2006: | added support for addresses as specified in RFC4517 | | ||
| 04 Dec 2006: | map utf8 strings from LDAP to the site's encoding and vice versa | | ||
| 30 Nov 2006: | replaced commonTagsHandler with a properly registered LDAP tag | | ||
| 31 Aug 2006: | added NO_PREFS_IN_TOPIC | | ||
| 19 Jul 2006: | public release | | ||
| 25 April 2006: | Initial (internal) version | | ||
| Perl Version: | 5.8 | | ||
| Plugin Home: | Foswiki:Extensions/%TOPIC% | | ||
| Feedback: | Foswiki:Extensions/%TOPIC%Dev | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/ | ||
# | ||
# Copyright (C) 2006-2009 Michael Daum http://michaeldaumconsulting.com | ||
# Portions Copyright (C) 2006 Spanlink Communications | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. For | ||
# more details read LICENSE in the root of this distribution. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
|
||
package Foswiki::Plugins::LdapNgPlugin; | ||
|
||
use strict; | ||
use vars qw($VERSION $RELEASE $isInitialized $NO_PREFS_IN_TOPIC $SHORTDESCRIPTION); | ||
|
||
$VERSION = '$Rev: 1801 $'; | ||
$RELEASE = 'v2.02'; | ||
$NO_PREFS_IN_TOPIC = 1; | ||
$SHORTDESCRIPTION = 'Query and display data from an LDAP directory'; | ||
|
||
############################################################################### | ||
sub initPlugin { | ||
$isInitialized = 0; | ||
|
||
Foswiki::Func::registerTagHandler('LDAP', \&handleLdap); | ||
Foswiki::Func::registerTagHandler('LDAPUSERS', \&handleLdapUsers); | ||
Foswiki::Func::registerTagHandler('EMAIL2WIKINAME', \&handleEmailToWikiName); | ||
|
||
# for testing only | ||
return 1; | ||
} | ||
|
||
############################################################################### | ||
sub initCore { | ||
return if $isInitialized; | ||
require Foswiki::Plugins::LdapNgPlugin::Core;; | ||
$isInitialized = 1; | ||
} | ||
|
||
############################################################################### | ||
sub handleLdap { | ||
initCore(); | ||
return Foswiki::Plugins::LdapNgPlugin::Core::handleLdap(@_); | ||
} | ||
|
||
############################################################################### | ||
sub handleLdapUsers { | ||
initCore(); | ||
return Foswiki::Plugins::LdapNgPlugin::Core::handleLdapUsers(@_); | ||
} | ||
|
||
############################################################################### | ||
sub handleEmailToWikiName { | ||
initCore(); | ||
return Foswiki::Plugins::LdapNgPlugin::Core::handleEmailToWikiName(@_); | ||
} | ||
|
||
1; |
Oops, something went wrong.