-
Bug
-
Resolution: Won't Do
-
Minor
-
None
-
2.7.1, 3.3.1
-
MOODLE_27_STABLE, MOODLE_33_STABLE
-
MDL-47783-master -
-
- Ensure unit tests are passing.
When using core_user_get_users (via REST in this case) it appears impossible to get values returned unless the web service user is given system admin privileges.
This appears to be caused by the call to user_get_user_details_courses($user) in /user/externallib.php [line 516 in 2.7.1]
This function will only return details if one of the following is satisfied:
1. can_view_user_details_cap($user)
2. ($user->id == $USER->id)
3. has_coursecontact_role($user->id)
Criteria 1 can only be satisfied if the web service user is assigned to every other user in the user context or by adding a course parameter option to the web service call - neither seem necessary although course id = 1 could be used in the latter case.
Criteria 2 is rarely satisfied as the web service user is unlikely to be interested in finding themselves.
Criteria 3 is not satisfied unless the Web Service user is listed as a course contact, which isn't appropriate in general.