MDL-49776 mod_lti: Set parameter in privacy check
authorspvickers <github@spvickers.freeserve.co.uk>
Tue, 7 Apr 2015 17:42:35 +0000 (18:42 +0100)
committerSimey Lameze <simey@moodle.com>
Mon, 25 May 2015 05:01:33 +0000 (13:01 +0800)
Moved sending of the lis_result_sourcedid parameter to within the block
which checks that grades are being accepted for the link.

mod/lti/locallib.php

index c51dda6..28ab4fc 100644 (file)
@@ -368,15 +368,13 @@ function lti_build_request($instance, $typeconfig, $course, $typeid = null, $isl
     }
     $placementsecret = $instance->servicesalt;
 
-    if ( isset($placementsecret) ) {
-        $sourcedid = json_encode(lti_build_sourcedid($instance->id, $USER->id, $placementsecret, $typeid));
-        $requestparams['lis_result_sourcedid'] = $sourcedid;
-    }
-
     if ( isset($placementsecret) && ($islti2 ||
          $typeconfig['acceptgrades'] == LTI_SETTING_ALWAYS ||
          ($typeconfig['acceptgrades'] == LTI_SETTING_DELEGATE && $instance->instructorchoiceacceptgrades == LTI_SETTING_ALWAYS))) {
 
+        $sourcedid = json_encode(lti_build_sourcedid($instance->id, $USER->id, $placementsecret, $typeid));
+        $requestparams['lis_result_sourcedid'] = $sourcedid;
+
         // Add outcome service URL.
         $serviceurl = new \moodle_url('/mod/lti/service.php');
         $serviceurl = $serviceurl->out();