Example #1
0
    def _exportBody(self):
        """ Export the object as a file body.
        """
        if not ILDAPMultiPlugin.providedBy(self.context):
            return None

        return XMLAdapterBase._exportBody(self)
    def _exportBody(self):
        """ Export the object as a file body.
        """
        if not ILDAPMultiPlugin.providedBy(self.context):
            return None

        return XMLAdapterBase._exportBody(self)
Example #3
0
def configure_ldap_credentials(context):
    site = getToolByName(context, 'portal_url').getPortalObject()
    ldap_plugins = [obj for obj in site.acl_users.objectValues()
                        if ILDAPMultiPlugin.providedBy(obj)]
    for ldap_plugin in ldap_plugins:
        ldap_uf = ldap_plugin.acl_users
        server = ldap_uf.getServers()[0]
        hostname = server['host']

        credentials = get_ldap_credentials(hostname)
        if credentials:
            binduid = credentials[ldap_plugin.id]['user'].encode('utf-8')
            bindpwd = credentials[ldap_plugin.id]['password'].encode('utf-8')

            # Update username and password on the LDAPUserFolder
            ldap_uf._binduid = binduid
            ldap_uf._bindpwd = bindpwd
            ldap_uf.binduid_usage = 1

            # Update username and password on the currently active LDAP connection
            ldap_uf._delegate.binduid_usage = 1
            ldap_uf._delegate.bind_dn = binduid
            ldap_uf._delegate.bind_pwd = bindpwd

            logger.info("Sucessfully configured LDAP credentials for '%s' (%s)." % (
                ldap_plugin.id,
                hostname))
        else:
            creds_file_path = get_credentials_file_path(hostname)
            logger.warn("No LDAP credentials file found for '%s' (%s)! "
                        "Make sure '%s' exists and has the proper format." % (
                        ldap_plugin.id, hostname, creds_file_path))
Example #4
0
def exportLDAPMultiPlugins(context):
    """ Export LDAPMultiPlugin settings to an XML file

    When using this step directly, the setup tool is expected to be
    inside the PluggableAuthService object
    """
    pas = context.getSite()
    ldapmultiplugins = [ x for x in context.getSite().objectValues()
                                        if ILDAPMultiPlugin.providedBy(x) ]

    if not ldapmultiplugins:
        context.getLogger('ldapmultiplugins').debug('Nothing to export.')

    for plugin in ldapmultiplugins:
        exportObjects(plugin, '', context)
def exportLDAPMultiPlugins(context):
    """ Export LDAPMultiPlugin settings to an XML file

    When using this step directly, the setup tool is expected to be
    inside the PluggableAuthService object
    """
    pas = context.getSite()
    ldapmultiplugins = [
        x for x in context.getSite().objectValues()
        if ILDAPMultiPlugin.providedBy(x)
    ]

    if not ldapmultiplugins:
        context.getLogger('ldapmultiplugins').debug('Nothing to export.')

    for plugin in ldapmultiplugins:
        exportObjects(plugin, '', context)
Example #6
0
 def _ldap_plugins(self):
     ldap_plugins = []
     for item in self.context['acl_users'].objectValues():
         if ILDAPMultiPlugin.providedBy(item):
             ldap_plugins.append(item)
     return ldap_plugins
Example #7
0
 def _ldap_plugins(self):
     ldap_plugins = []
     for item in self.context['acl_users'].objectValues():
         if ILDAPMultiPlugin.providedBy(item):
             ldap_plugins.append(item)
     return ldap_plugins