See Release Notes
Long Term Support Release
1 <?php 2 // This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>. 16 17 namespace core_user; 18 19 /** 20 * Update public key against registered user device. 21 * 22 * @package core 23 * @copyright Alex Morris <alex.morris@catalyst.net.nz> 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 * @since Moodle 4.2 26 */ 27 class devicekey { 28 /** 29 * Update the users public key for the specified device and app. 30 * 31 * @param string $uuid The device UUID. 32 * @param string $appid The app id, usually something like com.moodle.moodlemobile. 33 * @param string $publickey The app generated public key. 34 * @return bool 35 * @since Moodle 4.2 36 */ 37 public static function update_device_public_key(string $uuid, string $appid, string $publickey): bool { 38 global $DB, $USER; 39 40 $params = [ 41 'uuid' => $uuid, 42 'appid' => $appid, 43 'userid' => $USER->id, 44 ]; 45 46 if ($DB->record_exists('user_devices', $params)) { 47 $DB->set_field('user_devices', 'publickey', $publickey, $params); 48 return true; 49 } 50 return false; 51 } 52 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body