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 /** 18 * Data generator for repository plugin. 19 * 20 * @package repository_nextcloud 21 * @copyright 2017 Project seminar (Learnweb, University of Münster) 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die(); 26 27 /** 28 * Data generator for repository plugin. 29 * 30 * @package repository_nextcloud 31 * @copyright 2017 Project seminar (Learnweb, University of Münster) 32 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 33 */ 34 class repository_nextcloud_generator extends testing_repository_generator { 35 36 /** 37 * Creates an issuer and a user. 38 * @return \core\oauth2\issuer 39 */ 40 public function test_create_issuer () { 41 $issuerdata = new stdClass(); 42 $issuerdata->name = "Service"; 43 $issuerdata->clientid = "Clientid"; 44 $issuerdata->clientsecret = "Secret"; 45 $issuerdata->loginscopes = "openid profile email"; 46 $issuerdata->loginscopesoffline = "openid profile email"; 47 $issuerdata->baseurl = ""; 48 $issuerdata->image = "aswdf"; 49 50 // Create the issuer. 51 $issuer = \core\oauth2\api::create_issuer($issuerdata); 52 return $issuer; 53 } 54 55 /** 56 * Creates the required endpoints. 57 * @param int $issuerid 58 * @return \core\oauth2\issuer 59 */ 60 public function test_create_endpoints ($issuerid) { 61 $this->test_create_single_endpoint($issuerid, "ocs_endpoint"); 62 $this->test_create_single_endpoint($issuerid, "authorization_endpoint"); 63 $this->test_create_single_endpoint($issuerid, "webdav_endpoint", "https://www.default.test/webdav/index.php"); 64 $this->test_create_single_endpoint($issuerid, "token_endpoint"); 65 $this->test_create_single_endpoint($issuerid, "userinfo_endpoint"); 66 } 67 68 /** 69 * Create a single endpoint. 70 * 71 * @param int $issuerid 72 * @param string $endpointtype 73 * @param string $url 74 * @return \core\oauth2\endpoint An instantiated endpoint 75 */ 76 public function test_create_single_endpoint($issuerid, $endpointtype, $url="https://www.default.test") { 77 $endpoint = new stdClass(); 78 $endpoint->name = $endpointtype; 79 $endpoint->url = $url; 80 $endpoint->issuerid = $issuerid; 81 $return = \core\oauth2\api::create_endpoint($endpoint); 82 return $return; 83 } 84 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body