Merge branch '44279-27' of git://github.com/samhemelryk/moodle

This commit is contained in:
Damyon Wiese 2014-02-24 13:37:52 +08:00
commit e848a930d2
2 changed files with 11 additions and 1 deletions

View File

@ -540,7 +540,7 @@ function user_get_user_details_courses($user) {
} else {
// Try through course profile.
foreach ($courses as $course) {
if ($can_view_user_details_cap($user, $course) || ($user->id == $USER->id) || has_coursecontact_role($user->id)) {
if (can_view_user_details_cap($user, $course) || ($user->id == $USER->id) || has_coursecontact_role($user->id)) {
$userdetails = user_get_user_details($user, $course);
}
}

View File

@ -341,6 +341,16 @@ class core_user_externallib_testcase extends externallib_advanced_testcase {
// Only the own $USER username should be returned
$this->assertEquals(1, count($returnedusers));
// And finally test as one of the enrolled users.
$this->setUser($user1);
// Call the external function.
$returnedusers = core_user_external::get_users_by_field('username',
array($USER->username, $user1->username, $user2->username));
// Only the own $USER username should be returned still.
$this->assertEquals(1, count($returnedusers));
}
/**