You are here: Home / Documentation / How To's / How to list all your LDAP servers

How to list all your LDAP servers

by nguyen — published Aug 03, 2009 02:55 PM, last modified Aug 16, 2016 10:50 AM
script to put in root of Zope
# Script to place in Zope root 

uniqueDict = {} 

for itemTuple in context.items():
 (item, itemType) = itemTuple
 if str(itemType).startswith('<PloneSite at '):
   site = getattr(context, item)
   print "Plone site <a href=\"%s\">%s</a>: " % (site.portal_url()+'/acl_users/ldap_authentication/acl_users/manage_main', site.id)
   try:
     ldap = site.acl_users.ldap_authentication.acl_users.getCurrentServer()
   except:
     ldap = "n/a"
   print "    ", ldap, "<br>"
 elif str(itemType).startswith('<Folder at '):
   folder = getattr(context, item)
   for folderItemTuple in folder.items():
     (folderItem, folderItemType) = folderItemTuple
     if str(folderItemType).startswith('<PloneSite at '):
       site = getattr(folder, folderItem)
       print "Plone site <a href=\"%s\">%s</a>: " % (site.portal_url()+'/acl_users/ldap_authentication/acl_users/manage_main', site.id)
       try:
         ldap = site.acl_users.ldap_authentication.acl_users.getCurrentServer()
       except:
         ldap = "n/a"
       print "    ", ldap, "<br>"
    
return printed
Navigation