mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 22:15:24 +02:00
MDL-31520 user-ws: Optimised if statement for email access by moving admin check to the start
This commit is contained in:
parent
fd200bc5e5
commit
ca774c940e
@ -380,11 +380,11 @@ function user_get_user_details($user, $course = null, array $userfields = array(
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array('email', $userfields) && ($currentuser
|
||||
if (in_array('email', $userfields) && ($isadmin // The admin is allowed the users email
|
||||
or $currentuser // Of course the current user is as well
|
||||
or $canviewuseremail // this is a capability in course context, it will be false in usercontext
|
||||
or $user->maildisplay == 1
|
||||
or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER))
|
||||
or $isadmin)) {
|
||||
or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER)))) {
|
||||
$userdetails['email'] = $user->email;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user