Commit df287e89 authored by Nigel McNie's avatar Nigel McNie
Browse files

When deleting an auth instance, make sure to clear records out of auth_remote_user for it too.

This involves making sure that the lastauthinstance field of the usr table doesn't refer to the auth instance too.
parent e1c17aea
......@@ -365,6 +365,8 @@ function institution_submit(Pieform $form, $values) {
foreach($values['authplugin']['deletearray'] as $instanceid) {
execute_sql('UPDATE {usr} SET lastauthinstance = NULL WHERE lastauthinstance = ?', array(db_quote($instanceid)));
delete_records('auth_remote_user', 'authinstance', $instanceid);
delete_records('auth_instance_config', 'instance', $instanceid);
delete_records('auth_instance', 'id', $instanceid);
......@@ -639,7 +639,7 @@ function delete_user($userid) {
// by deleted users.
$authinst = get_field('auth_instance', 'id', 'institution', 'mahara', 'instancename', 'internal');
if ($authinst) {
$deleterec->authinstance = $authinst;
$deleterec->authinstance = $deleterec->lastauthinstance = $authinst;
update_record('usr', $deleterec);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment