As far as I can tell, the LDAP modules do not provide any easy method to disable LDAP authentication when the module is installed and enabled.
This proves to be difficult trying to automate build tests as the module needs to be disabled when importing or generating users (such as with drush generate-users
) when not able to access the LDAP server. If the LDAP module is a dependency on other custom Features then it proves to be very problematic as other functionality then might also be disabled.
Attached is a quick patch which works around this issue. It does not contain an UI changes (I will wait for approval of the idea first) but it does allow the new variable ldap_servers_enabled
to be set via drush or in the settings.php
file as $conf['ldap_servers_enabled']
.
Comments
Comment #1
andrewsuth CreditAttribution: andrewsuth at World Food Programme commentedComment #2
seanBThis is actually something we need as well. I have only 1 remark:
The search() function should return:
* @return
* An array of matching entries->attributes (will have 0
* elements if search returns no results),
* or FALSE on error.
I think we should return an empty array instead of TRUE?
Comment #3
seanBUpdated patch attached.
Comment #4
simeI have some integration tests using mink, the ones that need to log in hang locally when I can't access the LDAP server. I can make them work with:
Comment #5
grahlThis might be a dumb question but why can't you disable the LDAP server you configured before you run your tests?
Comment #6
simeIt's a general pattern you see in many modules. You let the module decide how to remain enabled and not make calls out.
Comment #8
grahlDoing a return directly in search but still trying to connect and bind is not a solution from my perspective, however, since configuration overrides work just fine for this, I've updated install.txt to mention them and provided examples, which solve both reported cases.