Skip to content

Commit

Permalink
Merge pull request #192 from danmarsden/fix188
Browse files Browse the repository at this point in the history
Fix #188 - allow re-use of existing function which requires sesskey.
  • Loading branch information
danmarsden authored Aug 20, 2024
2 parents f1054dc + bac2631 commit f4034d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion classes/plugins/mod_assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public static function reset($userid, $course, $config) {
$cm = get_coursemodule_from_instance('assign', $assign->id);
$context = \context_module::instance($cm->id);
if (has_capability('mod/assign:grade', $context)) {
// Assign add_attempt() is protected - use reflection so we don't have to write our own.
// Assign add_attempt() is protected and requires sesskey, use reflection so we don't have to write our own.
$_POST['sesskey'] = sesskey();
$r = new \ReflectionMethod('assign', 'add_attempt');
$r->setAccessible(true);
$r->invoke(new \assign($context, $cm, $course), $userid);
Expand Down

0 comments on commit f4034d6

Please sign in to comment.