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

Bugfix: Fetching user details from LDAP on manual user creation didn't work in some circumstances

parent 9ae2e15b
Branches
Tags
No related merge requests found
......@@ -16,6 +16,7 @@ This plugin requires Moodle 2.7+
Changes
-------
* 2014-09-12 - Bugfix: Fetching user details from LDAP on manual user creation didn't work in some circumstances
* 2014-09-02 - Bugfix: Check if LDAP auth is really used on manual user creation
* 2014-08-29 - Support login via email for first-time LDAP logins (MDL-46638)
* 2014-08-29 - Update version.php
......
......@@ -354,7 +354,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap {
$maxxcount = 100;
foreach ($users as $user) {
if (!$this->update_user_record($user->username, $updatekeys)) { // user_updated event is fired hereby
if (!$this->update_user_record($user->username, $updatekeys)) {
$skipped = ' - '.get_string('skipped');
}
else {
......
......@@ -26,13 +26,26 @@
defined('MOODLE_INTERNAL') || die;
function update_user_onevent($eventdata) {
// Do only if user has ldap_syncplus authentication and
// do only if username is enclosed in $eventdata - this event handler might be called twice when creating an user, so we have to handle this fact
if (isset($eventdata->auth) && $eventdata->auth == 'ldap_syncplus' && isset($eventdata->username) && is_string($eventdata->username)) {
global $DB;
// do only if user id is enclosed in $eventdata
if (!empty($eventdata->relateduserid)) {
// Get user data
$user = $DB->get_record('user', array('id' => $eventdata->relateduserid));
// Do if user was found
if (!empty($user->username)) {
// Do only if user has ldap_syncplus authentication
if (isset($user->auth) && $user->auth == 'ldap_syncplus') {
// Get LDAP Plugin
$authplugin = get_auth_plugin('ldap_syncplus');
// Update user
$authplugin->update_user_record($eventdata->username);
$authplugin->update_user_record($user->username);
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment