manager: display ldapsearch command on multiple lines (#68285)

This commit is contained in:
Frédéric Péters 2022-08-19 10:22:14 +02:00
parent 054cc05f49
commit 718c698b17
2 changed files with 9 additions and 2 deletions

View File

@ -3,7 +3,11 @@
<div class="a2-manager-ldap-{{ ldap.realm }}">
{% if not ldap.error %}
<h5>{% blocktrans %}Base ldapsearch command:{% endblocktrans %}</h5>
<pre>{% if ldap.require_cert != 'demand' %}LDAPTLS_REQCERT={{ldap.require_cert}} {% endif %}ldapsearch -v -H {{ ldap.ldap_uri }} -D "{{ ldap.binddn }}" -w "{{ ldap.bindpw }}" -b "{{ ldap.basedn }}"{% if ldap.user_filter or ldap.sync_ldap_users_filter %} "{% firstof ldap.sync_ldap_users_filter ldap.user_filter %}"{% endif %}</pre>
<pre>{% if ldap.require_cert != 'demand' %}LDAPTLS_REQCERT={{ldap.require_cert}} {% endif %}ldapsearch -v -H {{ ldap.ldap_uri }} \
-D "{{ ldap.binddn }}" \
-w "{{ ldap.bindpw }}" \
-b "{{ ldap.basedn }}"{% if ldap.user_filter or ldap.sync_ldap_users_filter %}
"{% firstof ldap.sync_ldap_users_filter ldap.user_filter %}"{% endif %}</pre>
{% else %}
<div class="error">
<p>{% blocktrans %}Error while attempting to connect to LDAP server, base ldapsearch command won't be displayed.{% endblocktrans %}</p>

View File

@ -2226,7 +2226,10 @@ def test_technical_info_ldap(app, admin, superuser, slapd, settings, monkeypatch
assert 'Base ldapsearch command' in ldap_config_text
assert 'ldapsearch -v -H ldapi://' in ldap_config_text
assert '-D "cn=Étienne Michu,o=ôrga" -w "passé" -b "o=ôrga" "(|(mail=*)(uid=*))"' in ldap_config_text
assert '-D "cn=Étienne Michu,o=ôrga"' in ldap_config_text
assert '-w "passé"' in ldap_config_text
assert '-b "o=ôrga"' in ldap_config_text
assert '"(|(mail=*)(uid=*))"' in ldap_config_text
for opt in [
'active_directory',