Hello,
In ldap configuration, you can also have some fields synchronized with
xwiki users profiles [1].
It doesn't work for pictures (I think), in my case I have a script that
gets pictures bytes from ldap, save this as a picture attachment in wiki
user profile and associates the pic as user avatar (field with same name in
user profile). I do this in cron for users with ldap infos, and without
avatar already.
Br,
Jeremie
[1] -
http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Authentication#HGeneric…
Le mar. 23 déc. 2014 12:29, Florian Kessler <
florian.kessler(a)kesslernetworks.de> a écrit :
  Hello all,
 what would be the best way to show pictures/thumbnails from an active
 directory in an xwiki site?
 So far, we are using groovy to contact an active directoy, extract user
 info, like name, mail, phone etc and return xwiki 2.0 syntax, see code below
 Now we would love to extend that contact list with photos stored in the
 active directory.
 Would that be possible? If so, how?
 Thanks in advance,
 Florian
 ---
 // KE1019746, März 13, fke
 // list contact data
 // to be included via includeInContext-Marco
 //
 // CAUTION: has to saved by user with programming rights
 // import lib for ldap access
 import org.apache.directory.groovyldap.*
 // ldap connection
 ldap = LDAP.newInstance('ldap://ad-server/', 'ldapbind',
'secret')
 ldapsearchParams = new Search()
 ldapsearchParams.base = 'OU=People,DC=domain,DC=de'
 ldapsearchParams.scope = SearchScope.SUB
 // for each letter in the alphabet
 //for ( letter in (('A'..'Z') + ('0'..'9')) ) {
 for ( letter in [ 'F' ] ) {
     ldapsearchParams.filter =
'(&(|(memberOf=CN=CN1-FIXME)(memberOf=CN=CN2-FIXME))(sn='
 + letter.toLowerCase() + '*))'
     // do the query
     resultsUnsorted = ldap.search(ldapsearchParams)
     // ldap output isn't sorted
     // 
http://www.openldap.org/lists/openldap-software/200003/
 msg00058.html
     // 'A robust client should not rely on servers maintaining any
     // particular order over what are defined as unordered sequences.
     //
     // If your client wants to present the attributes and their values
     // in some order, it should order them itself.'
     //
     // results is an array of hashed maps:
     // groovy:000> println results.getClass()
     // class java.util.ArrayList
     // groovy:000> println results[3].getClass()
     // class java.util.HashMap
     //
     // sort the array depending on the value of the field 'cn'
     results = resultsUnsorted.sort { it.sn }
     println results
     // if results contains at least one cn, i.e. ldap search result isn't
 emtpy
     if ( results.isEmpty() == false) {
         println '' // xwiki markup stunt - new line necessary to not merge
 different letters to one xwiki table
         println '==' + letter // xwiki markup - header
         println '|=Name|=Funktion|=Tel|=Mobile|=Privat|=Fax'
         for (entry in results) {
             if ( ! ( entry.dn.toUpperCase() =~ 'DEAKTIVIERT' ) ) {
                 print '|'
                 if ( entry.sn ) {
                     print entry.sn
                 }
                 if ( entry.givenname ) {
                     print " "
                     print entry.givenname
                 }
                 print '|'
                 if ( entry.title ) {
                     print entry.title
                 }
                 print '|'
                 if ( entry.telephonenumber ) {
                     print entry.telephonenumber
                 }
                 print '|'
                 if ( entry.mobile ) {
                     print entry.mobile
                 }
                 print '|'
                 if ( entry.homephone ) {
                     print entry.homephone
                 }
                 print '|'
                 if ( entry.facsimiletelephonenumber ) {
                     print entry.facsimiletelephonenumber
                 }
                 print '|'
                 if ( entry.thumbnailphoto ) {
                     byte [] picture = entry.thumbnailphoto
                     //print entry.thumbnailphoto
                     print picture
                 }
                 println '' // xwiki markup to 'close' table
                 //} else {
                 //    println 'No Match for ' + entry.dn.toUpperCase()
             }
         } // end for-token-loop
     } // end results-isnt-Empty
 } // end for-letter-in-alphabet-loop
 _______________________________________________
 users mailing list
 users(a)xwiki.org
 
http://lists.xwiki.org/mailman/listinfo/users