Permalink
Browse files

MDL-41101 verify contextlevel in all assign events

  • Loading branch information...
1 parent 4781ff2 commit 0202d43dd46ffd8ff8800ebc9ab098bd341cb247 Petr Skoda committed Apr 17, 2014
Showing with 13 additions and 4 deletions.
  1. +0 −4 mod/assign/classes/event/assessable_submitted.php
  2. +13 −0 mod/assign/classes/event/base.php
@@ -143,9 +143,5 @@ protected function validate_data() {
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 @@ protected function get_legacy_logdata() {
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.');
+ }
+ }
}

0 comments on commit 0202d43

Please sign in to comment.