MDL-64623 glossary: Check the entry id

The entry must match the glossary before you can do any action on it.
This commit is contained in:
Damyon Wiese
2019-07-02 08:54:36 +02:00
committed by Jenkins
parent ea1ac3c7ef
commit 043b38d580
+5
View File
@@ -39,6 +39,11 @@ if (! $entry = $DB->get_record("glossary_entries", array("id"=>$entry))) {
print_error('invalidentry');
}
// Permission checks are based on the course module instance so make sure it is correct.
if ($cm->instance != $entry->glossaryid) {
print_error('invalidentry');
}
require_login($course, false, $cm);
$context = context_module::instance($cm->id);
$manageentries = has_capability('mod/glossary:manageentries', $context);