-
Bug
-
Resolution: Fixed
-
Minor
-
4.3.6, 4.4.2
The LTI 1.3 Sync_Members task in enrol_lti never runs in context-level mode, since the contextmembershipurl property on the nrps_info task is overwritten before the method is run.
This is so in PHP 7.4, at least, and was an unexpected result.
A working fix is for get_context_memberships_url() in /enrol/lti/classes/local/ltiadvantage/entity/nrps_info.php to return a clone of that property instead of the property itself.
To reproduce:
Publish a resource from a course in Moodle T, the Tool, add it as an external tool on Moodle P, the Platform; then delete it on the platform so that the resource link is no longer valid.
Sync members should then catch a 400 error when making the NPRS call in get_resource_link_level_members and fall back to get_context_level_members.
However, $nrps->get_context_memberships_url()->out(false) will resolve to the NRPS url with the rlid parameter from the resource-link level request attempt included, and so it, too, results in the same 400 exception, caught in the main function, execute.