Merge branch 'MDL-59365-master-fix1' of http://github.com/damyon/moodle

This commit is contained in:
Dan Poltawski 2017-07-12 08:15:38 +01:00
commit f409b3984b

View file

@ -453,7 +453,11 @@ class core_enrol_external extends external_api {
$results = array();
foreach ($users['users'] as $id => $user) {
if ($userdetails = user_get_user_details($user)) {
// Note: We pass the course here to validate that the current user can at least view user details in this course.
// The user we are looking at is not in this course yet though - but we only fetch the minimal set of
// user records, and the user has been validated to have course:enrolreview in this course. Otherwise
// there is no way to find users who aren't in the course in order to enrol them.
if ($userdetails = user_get_user_details($user, $course)) {
$results[] = $userdetails;
}
}