Skip to content
Snippets Groups Projects
Commit 5178e16d authored by Alexander Bias's avatar Alexander Bias
Browse files

Adopt code changes in Moodle 3.2 core auth_ldap

parent c0287fc8
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,10 @@ moodle-auth_ldap_syncplus ...@@ -4,6 +4,10 @@ moodle-auth_ldap_syncplus
Changes Changes
------- -------
### Unreleased
* 2017-03-03 - Adopt code changes in Moodle 3.2 core auth_ldap
### v3.2-r1 ### v3.2-r1
* 2017-01-13 - Check compatibility for Moodle 3.2, no functionality change * 2017-01-13 - Check compatibility for Moodle 3.2, no functionality change
......
...@@ -96,7 +96,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap { ...@@ -96,7 +96,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
array_push($contexts, $this->config->create_context); array_push($contexts, $this->config->create_context);
} }
$ldap_pagedresults = ldap_paged_results_supported($this->config->ldap_version); $ldap_pagedresults = ldap_paged_results_supported($this->config->ldap_version, $ldapconnection);
$ldap_cookie = ''; $ldap_cookie = '';
foreach ($contexts as $context) { foreach ($contexts as $context) {
$context = trim($context); $context = trim($context);
......
...@@ -123,9 +123,31 @@ $fastpathoptions = array(AUTH_NTLM_FASTPATH_YESFORM => get_string('auth_ntlmsso_ ...@@ -123,9 +123,31 @@ $fastpathoptions = array(AUTH_NTLM_FASTPATH_YESFORM => get_string('auth_ntlmsso_
AUTH_NTLM_FASTPATH_ATTEMPT => get_string('auth_ntlmsso_ie_fastpath_attempt', 'auth_ldap')); AUTH_NTLM_FASTPATH_ATTEMPT => get_string('auth_ntlmsso_ie_fastpath_attempt', 'auth_ldap'));
$disabled = ''; $disabled = '';
if (!ldap_paged_results_supported($config->ldap_version)) { $pagedresultssupported = false;
if ($config->host_url !== '') {
/**
* We try to connect each and every time we open the config, because we want to set the Page
* Size setting as enabled or disabled depending on the configured LDAP server supporting
* pagination or not, and to notify the user about it. If the user changed the LDAP server (or
* the LDAP protocol version) last time, it might happen that paged results are no longer
* available and we want to show that to the user the next time she goes to the settings page.
*/
try {
$ldapconn = $this->ldap_connect();
$pagedresultssupported = ldap_paged_results_supported($config->ldap_version, $ldapconn);
} catch (Exception $e) {
// If we couldn't connect and get the supported options, we can only assume we don't support paged results.
$pagedresultssupported = false;
}
}
/* Make sure we only disable the paged result size setting and show the notification about it if
* there is a configured server that we tried to contact. Othersiwe, if someone's LDAP server does
* support paged results, they won't be able to turn it on the first time they set it up (because
* the field will be disabled).
*/
if (($config->host_url !== '') && (!$pagedresultssupported)) {
$disabled = ' disabled="disabled"'; $disabled = ' disabled="disabled"';
echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap')); echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'), \core\output\notification::NOTIFY_INFO);
} }
?> ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment