mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-61667 analytics: Remove duplicated capability checks
\core_analytics\model::create and \core_analytics\model::enable methods are called from install/upgrade scripts. Therefore, they should not include any capability check. Their capability checks are actually redundant, as the user capabilities are already checked in the entry-point scripts.
This commit is contained in:
parent
d887b0c7f7
commit
f54a4092c7
1 changed files with 4 additions and 8 deletions
|
@ -346,8 +346,6 @@ class model {
|
|||
$timesplittingid = false, $processor = null) {
|
||||
global $USER, $DB;
|
||||
|
||||
\core_analytics\manager::check_can_manage_models();
|
||||
|
||||
$indicatorclasses = self::indicator_classes($indicators);
|
||||
|
||||
$now = time();
|
||||
|
@ -360,6 +358,10 @@ class model {
|
|||
$modelobj->timemodified = $now;
|
||||
$modelobj->usermodified = $USER->id;
|
||||
|
||||
if ($target->based_on_assumptions()) {
|
||||
$modelobj->trained = 1;
|
||||
}
|
||||
|
||||
if ($timesplittingid) {
|
||||
if (!\core_analytics\manager::is_valid($timesplittingid, '\core_analytics\local\time_splitting\base')) {
|
||||
throw new \moodle_exception('errorinvalidtimesplitting', 'analytics');
|
||||
|
@ -385,10 +387,6 @@ class model {
|
|||
|
||||
$model = new static($modelobj);
|
||||
|
||||
if ($model->is_static()) {
|
||||
$model->mark_as_trained();
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
@ -1059,8 +1057,6 @@ class model {
|
|||
public function enable($timesplittingid = false) {
|
||||
global $DB, $USER;
|
||||
|
||||
\core_analytics\manager::check_can_manage_models();
|
||||
|
||||
$now = time();
|
||||
|
||||
if ($timesplittingid && $timesplittingid !== $this->model->timesplitting) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue