ensure user has_capability('mod/hotpot:attempt', $module) when viewing a HotPot or submitting results

This commit is contained in:
Gordon Bateson
2009-11-09 01:27:21 +00:00
parent 9218ade3ad
commit f50ea0419e
2 changed files with 5 additions and 1 deletions
+3 -1
View File
@@ -21,8 +21,10 @@
error("Course Module ID is incorrect");
}
// make sure this user is enrolled in this course
// make sure this user is enrolled in this course and can access this HotPot
require_login($course);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/hotpot:attempt', $context);
$next_url = "$CFG->wwwroot/course/view.php?id=$course->id";
$time = time();
+2
View File
@@ -34,8 +34,10 @@
}
}
// make sure this user is enrolled in this course and can access this HotPot
require_login($course);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/hotpot:attempt', $context);
}
// set nextpage (for error messages)
$nextpage = "$CFG->wwwroot/course/view.php?id=$course->id";