MDL-41101 verify contextlevel in all assign events
This commit is contained in:
@@ -143,9 +143,5 @@ class assessable_submitted extends base {
|
||||
if (!isset($this->other['submission_editable'])) {
|
||||
throw new \coding_exception('Other must contain the key submission_editable.');
|
||||
}
|
||||
|
||||
if ($this->contextlevel != CONTEXT_MODULE) {
|
||||
throw new \coding_exception('Context passed must be module context.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,4 +115,17 @@ abstract class base extends \core\event\base {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom validation.
|
||||
*
|
||||
* @throws \coding_exception
|
||||
*/
|
||||
protected function validate_data() {
|
||||
parent::validate_data();
|
||||
|
||||
if ($this->contextlevel != CONTEXT_MODULE) {
|
||||
throw new \coding_exception('Context passed must be module context.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user