See Release Notes
Long Term Support Release
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 enrol_lti\local\ltiadvantage\repository; 18 19 /** 20 * The legacy_consumer_repository class, instances of which are responsible for querying LTI 1.1/2.0 consumer info. 21 * 22 * @package enrol_lti 23 * @copyright 2021 Jake Dallimore <jrhdallimore@gmail.com> 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 class legacy_consumer_repository { 27 28 /** 29 * Get a list of all shared secrets which a given LTI 1.1/2.0 consumer is associated with. 30 * 31 * A single consumer key may be used across several tool definitions, with different secrets, thus permitting a 32 * one:many relationship between consumer and secret. 33 * @param string $consumerkey the key identifying the consumer. 34 * @return string[] an array of secrets corresponding to the consumer key. 35 */ 36 public function get_consumer_secrets(string $consumerkey): array { 37 global $DB; 38 $sql = "SELECT t.id, t.secret 39 FROM {enrol_lti_lti2_consumer} c 40 JOIN {enrol_lti_tool_consumer_map} cm 41 ON (c.id = cm.consumerid) 42 JOIN {enrol_lti_tools} t 43 ON (t.id = cm.toolid) 44 WHERE c.consumerkey256 = :consumerkey"; 45 return array_unique(array_column($DB->get_records_sql($sql, ['consumerkey' => $consumerkey]), 'secret')); 46 } 47 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body