mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-58774 auth_oauth2: Cleanup on user delete.
This commit is contained in:
parent
48ad73619f
commit
e0abc2e405
@ -319,4 +319,18 @@ class api {
|
||||
|
||||
$login->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete linked logins for a user.
|
||||
*
|
||||
* @param \core\event\user_deleted $event
|
||||
* @return boolean
|
||||
*/
|
||||
public static function user_deleted(\core\event\user_deleted $event) {
|
||||
global $DB;
|
||||
|
||||
$userid = $event->objectid;
|
||||
|
||||
return $DB->delete_records(linked_login::TABLE, ['userid' => $userid]);
|
||||
}
|
||||
}
|
||||
|
31
auth/oauth2/db/events.php
Normal file
31
auth/oauth2/db/events.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* This file definies observers needed by the plugin.
|
||||
*
|
||||
* @package auth_oauth2
|
||||
* @copyright 2017 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
// List of observers.
|
||||
$observers = [
|
||||
[
|
||||
'eventname' => '\core\event\user_deleted',
|
||||
'callback' => '\auth_oauth2\api::user_deleted',
|
||||
],
|
||||
];
|
@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2017032300; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2017050800; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2016112900; // Requires this Moodle version.
|
||||
$plugin->component = 'auth_oauth2'; // Full name of the plugin (used for diagnostics).
|
||||
|
Loading…
x
Reference in New Issue
Block a user