Skip to content

Commit

Permalink
MDL-59365 enrol: Teachers can see other users on the site
Browse files Browse the repository at this point in the history
In order to enrol new users into a course, you need to see users who are not in the current course.
  • Loading branch information
Damyon Wiese committed Jul 12, 2017
1 parent bd5416a commit 2cc2001
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion enrol/externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,11 @@ public static function get_potential_users($courseid, $enrolid, $search, $search

$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;
}
}
Expand Down

0 comments on commit 2cc2001

Please sign in to comment.