mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 16:04:25 +02:00
MDL-17009 restore of mnet users - prevent any user using local host to end with mnet auth ; merged from 19_STABLE
This commit is contained in:
parent
bc68144cf8
commit
adf8cf19bc
@ -2609,17 +2609,24 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
if (isset($mnethosts[$user->mnethosturl])) {
|
||||
$user->mnethostid = $mnethosts[$user->mnethosturl]->id;
|
||||
} else {
|
||||
// lookup failed, switch user auth to manual and host to local. MDL-17009
|
||||
if ($CFG->registerauth == 'email') {
|
||||
$user->auth = 'email';
|
||||
} else {
|
||||
$user->auth = 'manual';
|
||||
}
|
||||
$user->mnethostid = $CFG->mnet_localhost_id;
|
||||
// inform about the automatic switch of authentication/host
|
||||
$messages[] = get_string('mnetrestore_extusers_switchuserauth', 'admin', $user);
|
||||
}
|
||||
}
|
||||
//Arriving here, any user with mnet auth and using $CFG->mnet_localhost_id is wrong
|
||||
//as own server cannot be accesed over mnet. Change auth to manual and inform about the switch
|
||||
if ($user->auth == 'mnet' && $user->mnethostid == $CFG->mnet_localhost_id) {
|
||||
// Respect registerauth
|
||||
if ($CFG->registerauth == 'email') {
|
||||
$user->auth = 'email';
|
||||
} else {
|
||||
$user->auth = 'manual';
|
||||
}
|
||||
// inform about the automatic switch of authentication/host
|
||||
if(empty($user->mnethosturl)) {
|
||||
$user->mnethosturl = '----';
|
||||
}
|
||||
$messages[] = get_string('mnetrestore_extusers_switchuserauth', 'admin', $user);
|
||||
}
|
||||
unset($user->mnethosturl);
|
||||
|
||||
//To store user->id along all the iteration
|
||||
|
Loading…
x
Reference in New Issue
Block a user