1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 namespace tool_mfa\event; 18 19 use stdClass; 20 21 /** 22 * Event for when user successfully revoked MFA Factor. 23 * 24 * @property-read array $other { 25 * Extra information about event. 26 * } 27 * 28 * @package tool_mfa 29 * @author Mikhail Golenkov <golenkovm@gmail.com> 30 * @copyright Catalyst IT 31 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 32 */ 33 class user_revoked_factor extends \core\event\base { 34 35 /** 36 * Create instance of event. 37 * 38 * @param stdClass $user the User object of the User who has revoked new factor 39 * @param string $factorname revoked factor 40 * 41 * @return self the related event 42 * 43 * @throws \coding_exception 44 */ 45 public static function user_revoked_factor_event(stdClass $user, $factorname): self { 46 47 $data = [ 48 'relateduserid' => null, 49 'context' => \context_user::instance($user->id), 50 'other' => [ 51 'userid' => $user->id, 52 'factorname' => $factorname, 53 ], 54 ]; 55 56 return self::create($data); 57 } 58 59 /** 60 * Init method. 61 * 62 * @return void 63 */ 64 protected function init(): void { 65 $this->data['crud'] = 'd'; 66 $this->data['edulevel'] = self::LEVEL_OTHER; 67 } 68 69 /** 70 * Returns description of what happened. 71 * 72 * @return string 73 */ 74 public function get_description(): string { 75 return "The user with id '{$this->other['userid']}' successfully revoked {$this->other['factorname']}"; 76 } 77 78 /** 79 * Return localised event name. 80 * 81 * @return string 82 * @throws \coding_exception 83 */ 84 public static function get_name(): string { 85 return get_string('event:userrevokedfactor', 'tool_mfa'); 86 } 87 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body