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

Adopt code changes from Moodle 3.10 core auth_ldap.

parent 02304aef
Branches
Tags
No related merge requests found
...@@ -6,6 +6,7 @@ Changes ...@@ -6,6 +6,7 @@ Changes
### Unreleased ### Unreleased
* 2020-12-11 - Adopt code changes from Moodle 3.10 core auth_ldap.
* 2020-12-11 - Prepare compatibility for Moodle 3.10. * 2020-12-11 - Prepare compatibility for Moodle 3.10.
* 2020-12-10 - Change in Moodle release support: * 2020-12-10 - Change in Moodle release support:
For the time being, this plugin is maintained for the most recent LTS release of Moodle as well as the most recent major release of Moodle. For the time being, this plugin is maintained for the most recent LTS release of Moodle as well as the most recent major release of Moodle.
......
...@@ -118,7 +118,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap { ...@@ -118,7 +118,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
do { do {
if ($ldappagedresults) { if ($ldappagedresults) {
// TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 4.1). // TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 3.11).
if (version_compare(PHP_VERSION, '7.3.0', '<')) { if (version_compare(PHP_VERSION, '7.3.0', '<')) {
// Before 7.3, use this function that was deprecated in PHP 7.4. // Before 7.3, use this function that was deprecated in PHP 7.4.
ldap_control_paged_result($ldapconnection, $this->config->pagesize, true, $ldapcookie); ldap_control_paged_result($ldapconnection, $this->config->pagesize, true, $ldapcookie);
...@@ -131,7 +131,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap { ...@@ -131,7 +131,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
} }
if ($this->config->search_sub) { if ($this->config->search_sub) {
// Use ldap_search to find first user from subtree. // Use ldap_search to find first user from subtree.
// TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 4.1). // TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 3.11).
if (version_compare(PHP_VERSION, '7.3.0', '<')) { if (version_compare(PHP_VERSION, '7.3.0', '<')) {
$ldapresult = ldap_search($ldapconnection, $context, $filter, array($this->config->user_attribute)); $ldapresult = ldap_search($ldapconnection, $context, $filter, array($this->config->user_attribute));
} else { } else {
...@@ -140,7 +140,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap { ...@@ -140,7 +140,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
} }
} else { } else {
// Search only in this context. // Search only in this context.
// TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 4.1). // TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 3.11).
if (version_compare(PHP_VERSION, '7.3.0', '<')) { if (version_compare(PHP_VERSION, '7.3.0', '<')) {
$ldapresult = ldap_list($ldapconnection, $context, $filter, array($this->config->user_attribute)); $ldapresult = ldap_list($ldapconnection, $context, $filter, array($this->config->user_attribute));
} else { } else {
...@@ -154,7 +154,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap { ...@@ -154,7 +154,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
if ($ldappagedresults) { if ($ldappagedresults) {
// Get next server cookie to know if we'll need to continue searching. // Get next server cookie to know if we'll need to continue searching.
$ldapcookie = ''; $ldapcookie = '';
// TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 4.1). // TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 3.11).
if (version_compare(PHP_VERSION, '7.3.0', '<')) { if (version_compare(PHP_VERSION, '7.3.0', '<')) {
// Before 7.3, use this function that was deprecated in PHP 7.4. // Before 7.3, use this function that was deprecated in PHP 7.4.
$pagedresp = ldap_control_paged_result_response($ldapconnection, $ldapresult, $ldapcookie); $pagedresp = ldap_control_paged_result_response($ldapconnection, $ldapresult, $ldapcookie);
...@@ -451,9 +451,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap { ...@@ -451,9 +451,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
// //
// The cast to int is a workaround for MDL-53959. // The cast to int is a workaround for MDL-53959.
$user->suspended = (int)$this->is_user_suspended($user); $user->suspended = (int)$this->is_user_suspended($user);
if (empty($user->lang)) {
$user->lang = $CFG->lang;
}
if (empty($user->calendartype)) { if (empty($user->calendartype)) {
$user->calendartype = $CFG->calendartype; $user->calendartype = $CFG->calendartype;
} }
......
...@@ -27,8 +27,9 @@ defined('MOODLE_INTERNAL') || die; ...@@ -27,8 +27,9 @@ defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) { if ($ADMIN->fulltree) {
if (!function_exists('ldap_connect')) { if (!function_exists('ldap_connect')) {
$settings->add(new admin_setting_heading('auth_ldap_syncplus_noextension', '', $notify = new \core\output\notification(get_string('auth_ldap_noextension', 'auth_ldap'),
get_string('auth_ldap_noextension', 'auth_ldap'))); \core\output\notification::NOTIFY_WARNING);
$settings->add(new admin_setting_heading('auth_ldap_noextension', '', $OUTPUT->render($notify)));
} else { } else {
// We use a couple of custom admin settings since we need to massage the data before it is inserted into the DB. // We use a couple of custom admin settings since we need to massage the data before it is inserted into the DB.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment