Welcome, Registration, and other StartingPoints; Foswiki history & Wiki style; All the docs...
Edit | Attach | New | Raw | Delete | History | Print | Tools
You are here: System » RenderLdapUser

RenderLdapUser

Description

Extract user information from an Ldap directory. Note, you have to install the Foswiki:Extensions/LdapNgPlugin to make this work. Depending on your directory layout and the used schema you have to adjust the filter below.

Parameters

  • KEY: key used to fetc the user record, e.g. the login name

Implementation

%STARTINCLUDE%
%~~ LDAP{"(&(objectClass=posixAccount)(uid=%KEY%))" 
~~~   clear="$jpegPhoto,$cn,$mail,$telephoneNumber,$o,$postalAddress"
~~~   limit="1"
~~~   format="
~~~     <div class=\"alt\">
~~~     <table cellspacing=\"5\">
~~~     <tr>
~~~       $percntIFDEFINEDTHEN{\"$jpegPhoto\" as=\"$[j]pegPhoto\"}$percnt
~~~       <td valign=\"top\">
~~~         <img src=\"$jpegPhoto\" alt=\"$cn\" title=\"$cn\" width=\"100px\">
~~~       </td>
~~~       $percntFIDEFINED$percnt
~~~       <td valign=\"top\">
~~~         <table>
~~~           <tr><th valign=\"top\">Name:</th>
~~~               <td valign=\"top\"> $cn </td></tr>
~~~           <tr><th valign=\"top\">Email:</th>
~~~               <td valign=\"top\"> $mail </td></tr>
~~~           <tr><th valign=\"top\">Tel:</th>
~~~               <td valign=\"top\"> $telephoneNumber </td></tr>
~~~           <tr><th valign=\"top\">Organization:</th>
~~~               <td valign=\"top\"> $o </td></tr>
~~~           <tr><th valign=\"top\">Address:</th>
~~~               <td valign=\"top\"> $postalAddress </td></tr>
~~~         </table>
~~~       </td>
~~~     </tr>
~~~    </table>
~~~    </div>"
~~~ }%
%STOPINCLUDE%

Test

%LDAP{"(&(objectClass=posixAccount)(uid=guest))" clear="$jpegPhoto,$cn,$mail,$telephoneNumber,$o,$postalAddress" limit="1" format="

$percntIFDEFINEDTHEN{\"$jpegPhoto\" as=\"$[j]pegPhoto\"}$percnt $percntFIDEFINED$percnt
\"$cn\"
Name: $cn
Email: $mail
Tel: $telephoneNumber
Organization: $o
Address: $postalAddress
" }% spacer
Copyright © 2014 Atomikos BVBA. Transaction Management for Extreme Transaction Processing and SOA Environments serving ISV, Commercial, OEM and Open Source Markets
Site map RSS ATOM