From 1f84c2c5eab332bd016c2c033e3054f7fdfc09c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Fri, 28 Oct 2016 13:44:17 +0200 Subject: [PATCH] MDL-56638 assign: Don't check sesskey using submit_grading_form from WS --- mod/assign/externallib.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mod/assign/externallib.php b/mod/assign/externallib.php index b815f75e639..1700011ffd9 100644 --- a/mod/assign/externallib.php +++ b/mod/assign/externallib.php @@ -1506,7 +1506,7 @@ class mod_assign_external extends external_api { * @param int $userid The id of the user the submission belongs to. * @param string $jsonformdata The data from the form, encoded as a json array. * @return array of warnings to indicate any errors. - * @since Moodle 2.6 + * @since Moodle 3.1 */ public static function submit_grading_form($assignmentid, $userid, $jsonformdata) { global $CFG, $USER; @@ -1537,6 +1537,12 @@ class mod_assign_external extends external_api { 'gradingpanel' => true ); + if (WS_SERVER) { + // Assume form submission if coming from WS. + $USER->ignoresesskey = true; + $data['_qf__mod_assign_grade_form_'.$params['userid']] = 1; + } + $customdata = (object) $data; $formparams = array($assignment, $customdata, $options);