-
Bug
-
Resolution: Fixed
-
Major
-
3.0.5, 3.1.1, 3.1.5, 3.2.2
-
MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_32_STABLE
-
MOODLE_31_STABLE, MOODLE_32_STABLE
-
MDL-55371-master -
mod/assign/externallib.php function get_participant()
This web service that this function implements has a required return parameter of 'user' (the user object). However, this is obtained by calling user_get_user_details(). Unfortunately, there's lots of situations in which this function can simply return null. This will result in the web service returning an extremely unhelpful error (basically a required return field is empty) as lib/externallib checks the return values against the description and throws an exception due to the missing user object.
This can happen - for example - if the moodle/user:viewdetails capability is "off" for the current user. It's unlikely but possible if a custom teacher-like role is created and/or capabilities are overridden within the course.
To illustrate... a client had a "marker" role based on teacher for marking assignments. This had (probably by mistake, but I don't think that matters) been overiden in a course and moodle/user:viewdetails cap set to prevent. The result should probably be that you can't do marking if you can't see the user details. However, it got into the PDF interface and just produced an arcane message about an object or array being required in a JavaScript popup. Took a lot of tracking down.