Created
October 27, 2010 11:22
-
-
Save claytron/648864 to your computer and use it in GitHub Desktop.
A script that can be used in conjunction with collective.recipe.plonesite to disable LDAP
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
# id of the ldap plugin the PloneSite/acl_users | |
ldap_plugin_id = "ldap-plugin" | |
# turn off the ldap plugin for local testing | |
interfaces = [ | |
"IAuthenticationPlugin", | |
"ICredentialsResetPlugin", | |
"IGroupEnumerationPlugin", | |
"IGroupsPlugin", | |
"IPropertiesPlugin", | |
"IRoleEnumerationPlugin", | |
"IRolesPlugin", | |
"IUserEnumerationPlugin" | |
] | |
# this code is mostly taken from | |
# Products.PluggableAuthService.plugins.BasePlugin.manage_activateInterfaces | |
ldap_plugin = portal.acl_users[ldap_plugin_id] | |
pas_instance = ldap_plugin._getPAS() | |
plugins = pas_instance._getOb('plugins') | |
active_interfaces = [] | |
for iface_name in interfaces: | |
active_interfaces.append(plugins._getInterfaceFromName(iface_name )) | |
for iface in active_interfaces: | |
try: | |
plugins.deactivatePlugin(iface, ldap_plugin_id) | |
except KeyError: | |
print "%s plugin already disabled for %s" % (iface, ldap_plugin_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment