MDL-41101 verify contextlevel in all assign events

This commit is contained in:
Petr Skoda
2014-04-17 11:01:18 +08:00
parent 4781ff2e5f
commit 0202d43dd4
2 changed files with 13 additions and 4 deletions
@@ -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.');
}
}
}
+13
View File
@@ -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.');
}
}
}