MDL-83180 reportbuilder: correct access check for viewing schedules.

This commit is contained in:
Paul Holden
2024-10-02 16:49:26 +08:00
committed by Jun Pataleta
parent c75ec7503c
commit 6e77a2070d
2 changed files with 8 additions and 1 deletions
@@ -91,7 +91,10 @@ class report_schedules extends system_report {
* @return bool
*/
protected function can_view(): bool {
return permission::can_view_reports_list();
$reportid = $this->get_parameter('reportid', 0, PARAM_INT);
$report = report::get_record(['id' => $reportid], MUST_EXIST);
return permission::can_edit_report($report);
}
/**
+4
View File
@@ -89,6 +89,8 @@ abstract class system_report extends base {
* This is necessary to implement independently of the page that would typically embed the report because
* subsequent pages are requested via AJAX requests, and access should be validated each time
*
* Report parameters should also be considered when implementing this method
*
* @return bool
*/
abstract protected function can_view(): bool;
@@ -258,6 +260,8 @@ abstract class system_report extends base {
/**
* Return specific report parameter
*
* Capability/permission checks relating to parameters retrieved here should also be considered in your {@see can_view} method
*
* @param string $param
* @param mixed $default
* @param string $type