MDL-76583 core_external: Migrate restricted_context_exception class

This commit is contained in:
Andrew Nicols
2023-01-19 07:33:35 +08:00
parent 698f06edeb
commit fff2c7420f
3 changed files with 34 additions and 21 deletions
-1
View File
@@ -28,7 +28,6 @@ use external_value;
use invalid_parameter_exception;
use invalid_response_exception;
use moodle_exception;
use restricted_context_exception;
/**
* Base class for external api methods.
+33
View File
@@ -0,0 +1,33 @@
<?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/>.
namespace core_external;
/**
* Exception indicating user is not allowed to use external function in the current context.
*
* @package core_external
* @copyright 2009 Petr Skodak
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class restricted_context_exception extends \moodle_exception {
/**
* Constructor
*/
public function __construct() {
parent::__construct('restrictedcontextexception', 'error');
}
}
+1 -20
View File
@@ -25,33 +25,14 @@
defined('MOODLE_INTERNAL') || die();
/**
* Exception indicating user is not allowed to use external function in the current context.
*
* @package core_webservice
* @copyright 2009 Petr Skodak
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.0
*/
class restricted_context_exception extends moodle_exception {
/**
* Constructor
*
* @since Moodle 2.0
*/
function __construct() {
parent::__construct('restrictedcontextexception', 'error');
}
}
class_alias(\core_external\external_api::class, 'external_api');
class_alias(\core_external\restricted_context_exception::class, 'restricted_context_exception');
class_alias(\core_external\external_description::class, 'external_description');
class_alias(\core_external\external_value::class, 'external_value');
class_alias(\core_external\external_single_structure::class, 'external_single_structure');
class_alias(\core_external\external_multiple_structure::class, 'external_multiple_structure');
class_alias(\core_external\external_function_parameters::class, 'external_function_parameters');
/**
* Generate a token
*