This commit is contained in:
Huong Nguyen 2024-06-17 15:53:00 +07:00
commit e7a432c01d
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A
51 changed files with 63 additions and 42 deletions

View File

@ -0,0 +1,10 @@
issueNumber: MDL-82133
notes:
core_reportbuilder:
- message: >-
The following classes have been moved to use the new exception API as a l2 namespace:
- `core_reportbuilder\\report_access_exception` => `core_reportbuilder\\exception\\report_access_exception`
- `core_reportbuilder\\source_invalid_exception` => `core_reportbuilder\\exception\\source_invalid_exception`
- `core_reportbuilder\\source_unavailable_exception` => `core_reportbuilder\\exception\\source_unavailable_exception`
type: changed

View File

@ -49,4 +49,8 @@ $renamedclasses = [
'core_question\\bank\\search\\condition' => 'core_question\\local\\bank\\condition',
'core_question\\bank\\search\\category_condition' => 'qbank_managecategories\\category_condition',
'core_question\\bank\\search\\hidden_condition' => 'qbank_deletequestion\\hidden_condition',
// Since Moodle 4.5.
'core_reportbuilder\\report_access_exception' => 'core_reportbuilder\\exception\\report_access_exception',
'core_reportbuilder\\source_invalid_exception' => 'core_reportbuilder\\exception\\source_invalid_exception',
'core_reportbuilder\\source_unavailable_exception' => 'core_reportbuilder\\exception\\source_unavailable_exception',
];

View File

@ -16,7 +16,7 @@
declare(strict_types=1);
namespace core_reportbuilder;
namespace core_reportbuilder\exception;
use moodle_exception;

View File

@ -16,7 +16,7 @@
declare(strict_types=1);
namespace core_reportbuilder;
namespace core_reportbuilder\exception;
use moodle_exception;

View File

@ -16,7 +16,7 @@
declare(strict_types=1);
namespace core_reportbuilder;
namespace core_reportbuilder\exception;
use moodle_exception;

View File

@ -23,7 +23,7 @@ use core_external\external_multiple_structure;
use core_external\external_single_structure;
use core_external\external_function_parameters;
use core_external\external_value;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\system_report_factory;
/**

View File

@ -99,7 +99,7 @@ class audience extends dynamic_form {
/**
* Ensure current user is able to use this form
*
* A {@see \core_reportbuilder\report_access_exception} will be thrown if they can't
* A {@see \core_reportbuilder\exception\report_access_exception} will be thrown if they can't
*/
protected function check_access_for_dynamic_submission(): void {
$audience = $this->get_audience();

View File

@ -59,7 +59,7 @@ class condition extends dynamic_form {
/**
* Ensure current user is able to use this form
*
* A {@see \core_reportbuilder\report_access_exception} will be thrown if they can't
* A {@see \core_reportbuilder\exception\report_access_exception} will be thrown if they can't
*/
protected function check_access_for_dynamic_submission(): void {
permission::require_can_edit_report($this->get_report()->get_report_persistent());

View File

@ -60,7 +60,7 @@ class filter extends dynamic_form {
/**
* Ensure current user is able to use this form
*
* A {@see \core_reportbuilder\report_access_exception} will be thrown if they can't
* A {@see \core_reportbuilder\exception\report_access_exception} will be thrown if they can't
*/
protected function check_access_for_dynamic_submission(): void {
$reportpersistent = $this->get_report()->get_report_persistent();

View File

@ -74,7 +74,7 @@ class report extends dynamic_form {
/**
* Ensure current user is able to use this form
*
* A {@see \core_reportbuilder\report_access_exception} will be thrown if they can't
* A {@see \core_reportbuilder\exception\report_access_exception} will be thrown if they can't
*/
protected function check_access_for_dynamic_submission(): void {
$report = $this->get_custom_report();

View File

@ -62,7 +62,7 @@ class schedule extends dynamic_form {
/**
* Ensure current user is able to use this form
*
* A {@see \core_reportbuilder\report_access_exception} will be thrown if they can't
* A {@see \core_reportbuilder\exception\report_access_exception} will be thrown if they can't
*/
protected function check_access_for_dynamic_submission(): void {
$persistent = $this->get_report()->get_report_persistent();

View File

@ -25,7 +25,7 @@ use core\output\notification;
use core_reportbuilder\external\custom_report_audience_cards_exporter;
use core_reportbuilder\local\helpers\database;
use core_reportbuilder\local\models\audience;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
/**
* Audience base class

View File

@ -24,6 +24,7 @@ use core_plugin_manager;
use stdClass;
use core_reportbuilder\local\models\report;
use core_reportbuilder\local\report\base;
use core_reportbuilder\exception\{source_invalid_exception, source_unavailable_exception};
/**
* Report management class

View File

@ -20,6 +20,7 @@ namespace core_reportbuilder;
use context;
use context_system;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\helpers\audience;
use core_reportbuilder\local\models\report;
use core_reportbuilder\local\report\base;

View File

@ -20,6 +20,7 @@ namespace core_reportbuilder;
use action_menu_filler;
use coding_exception;
use core_reportbuilder\exception\report_access_exception;
use html_writer;
use stdClass;
use core\output\checkbox_toggleall;

View File

@ -21,6 +21,7 @@ namespace core_reportbuilder;
use context;
use core_reportbuilder\local\models\report;
use core_reportbuilder\local\report\base;
use core_reportbuilder\exception\source_invalid_exception;
/**
* Factory class for creating system report instances

View File

@ -49,7 +49,7 @@ if ($reportpersistent->get('type') === \core_reportbuilder\local\report\base::TY
$reportpersistent->get('area'), $reportpersistent->get('itemid'), $parameters);
if (!$systemreport->can_be_downloaded()) {
throw new \core_reportbuilder\report_access_exception();
throw new \core_reportbuilder\exception\report_access_exception();
}
// Combine original report parameters with 'download' parameter.

View File

@ -23,7 +23,7 @@ use core_reportbuilder\local\models\audience;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_user\reportbuilder\datasource\users;
defined('MOODLE_INTERNAL') || die();

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\columns;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\column;
use core_user\reportbuilder\datasource\users;

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\columns;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\column;
use core_user\reportbuilder\datasource\users;

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\columns;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\column;
use core_user\reportbuilder\datasource\users;

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\columns\sort;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_user\reportbuilder\datasource\users;
defined('MOODLE_INTERNAL') || die();

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\columns\sort;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\column;
use core_user\reportbuilder\datasource\users;

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\columns\sort;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\column;
use core_user\reportbuilder\datasource\users;

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\conditions;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\filter;
use core_user\reportbuilder\datasource\users;

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\conditions;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\filter;
use core_user\reportbuilder\datasource\users;

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\conditions;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\filter;
use core_user\reportbuilder\datasource\users;

View File

@ -22,7 +22,7 @@ use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\manager;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_user\reportbuilder\datasource\users;
defined('MOODLE_INTERNAL') || die();

View File

@ -22,7 +22,7 @@ use core_reportbuilder\manager;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\filter;
use core_user\reportbuilder\datasource\users;

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\filters;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\filter;
use core_user\reportbuilder\datasource\users;

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\filters;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\filter;
use core_user\reportbuilder\datasource\users;

View File

@ -20,7 +20,7 @@ namespace core_reportbuilder\external\filters;
use core_reportbuilder_generator;
use core_reportbuilder\manager;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_external\external_api;
use externallib_advanced_testcase;
use core_user\reportbuilder\datasource\users;

View File

@ -20,7 +20,7 @@ namespace core_reportbuilder\external\filters;
use core_reportbuilder_generator;
use core_reportbuilder\manager;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_external\external_api;
use externallib_advanced_testcase;
use core_user\reportbuilder\datasource\users;

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\reports;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\report;
use core_user\reportbuilder\datasource\users;

View File

@ -22,7 +22,7 @@ use context_system;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_user\reportbuilder\datasource\users;
defined('MOODLE_INTERNAL') || die();

View File

@ -22,7 +22,7 @@ use context_system;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\report;
use core_user\reportbuilder\datasource\users;

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\reports;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_user\reportbuilder\datasource\users;
defined('MOODLE_INTERNAL') || die();

View File

@ -22,7 +22,7 @@ use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\event\report_viewed;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\models\report;
use core_user\reportbuilder\datasource\users;

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\schedules;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_user\reportbuilder\datasource\users;
defined('MOODLE_INTERNAL') || die();

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\schedules;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\task\send_schedule;
use core_user\reportbuilder\datasource\users;

View File

@ -21,7 +21,7 @@ namespace core_reportbuilder\external\schedules;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_user\reportbuilder\datasource\users;
defined('MOODLE_INTERNAL') || die();

View File

@ -22,7 +22,7 @@ use core\context\system;
use core_reportbuilder_generator;
use core_external\external_api;
use externallib_advanced_testcase;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder\local\systemreports\reports_list;
use core_user\reportbuilder\datasource\users;

View File

@ -25,6 +25,7 @@ use core_user\reportbuilder\datasource\users;
use stdClass;
use core_reportbuilder\local\models\report;
use core_reportbuilder\local\report\base;
use core_reportbuilder\exception\{source_invalid_exception, source_unavailable_exception};
defined('MOODLE_INTERNAL') || die();

View File

@ -20,7 +20,7 @@ namespace core_reportbuilder\output;
use advanced_testcase;
use core_reportbuilder_generator;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_user\reportbuilder\datasource\users;
/**

View File

@ -20,7 +20,7 @@ namespace core_reportbuilder\output;
use advanced_testcase;
use core_reportbuilder_generator;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_user\reportbuilder\datasource\users;
/**

View File

@ -20,7 +20,7 @@ namespace core_reportbuilder\output;
use advanced_testcase;
use core_reportbuilder_generator;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_user\reportbuilder\datasource\users;
/**

View File

@ -20,7 +20,7 @@ namespace core_reportbuilder\output;
use advanced_testcase;
use core_reportbuilder_generator;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_user\reportbuilder\datasource\users;
/**

View File

@ -20,7 +20,7 @@ namespace core_reportbuilder\output;
use advanced_testcase;
use core_reportbuilder_generator;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_user\reportbuilder\datasource\users;
/**

View File

@ -20,7 +20,7 @@ namespace core_reportbuilder\output;
use advanced_testcase;
use core_reportbuilder_generator;
use core_reportbuilder\report_access_exception;
use core_reportbuilder\exception\report_access_exception;
use core_user\reportbuilder\datasource\users;
/**

View File

@ -20,6 +20,7 @@ namespace core_reportbuilder;
use advanced_testcase;
use context_system;
use core_reportbuilder\exception\report_access_exception;
use core_reportbuilder_generator;
use Throwable;
use core_user\reportbuilder\datasource\users;

View File

@ -21,6 +21,7 @@ namespace core_reportbuilder;
use advanced_testcase;
use context_system;
use stdClass;
use core_reportbuilder\exception\{source_invalid_exception, source_unavailable_exception};
/**
* Unit tests for the system report factory class