-
Improvement
-
Resolution: Fixed
-
Minor
-
3.8.5
-
MOODLE_38_STABLE
-
MOODLE_311_STABLE
-
MDL-69869-master -
-
Moppies Kanban
I need to retrieve all Moodle suspended users enrolled in a course (participants) via REST web service functions (Moodle 3.8.4).
Normally, I use the API function core_enrol_get_enrolled_users. Unfortunately, it does not expose the participants suspended field in the response.
I searched the available web services for a course/participant API function that contains the suspended filed. And indeed, core_enrol_search_users seems to fit the bill (the web service call was added in 3.8, it looks like) however, the suspended property field is marked as an optional response. And here comes the problem: When I call the API function the optional suspended field is not returned (nor any other optional data).
My first thought was: A permission issue. According to the Site Admin settings->Web Services->Funtions this API call asks for the permission moodle/course:viewparticipants.
I tried to add it but to no avail. I cannot see how I can add these permissions to my user or role since the API user has already sys admin privileges. This should cover it already, and I can see suspensions in the UI if I browser a course using this user. So, what needs to be done to retrieve the suspended info via web services?