Skip to content

Commit

Permalink
ensure user has_capability('mod/hotpot:attempt', $module) when viewin…
Browse files Browse the repository at this point in the history
…g a HotPot or submitting results
  • Loading branch information
Gordon Bateson committed Nov 9, 2009
1 parent 9218ade commit f50ea04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mod/hotpot/attempt.php
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions mod/hotpot/view.php
Expand Up @@ -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";
Expand Down

0 comments on commit f50ea04

Please sign in to comment.