Skip to content

Commit ab920e3

Browse files
committed
MDL-85811 user_profile: fix capability checks for viewing user details
Supporting teacher view
1 parent a46fde0 commit ab920e3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

user/profile/lib.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,9 @@ public function is_visible(?context $context = null): bool {
471471
} else if ($this->userid == $USER->id) {
472472
return true;
473473
} else if ($this->userid > 0) {
474-
return has_capability('moodle/user:viewalldetails', $context);
475-
} else {
476474
$coursecontext = context_course::instance($COURSE->id);
477-
return has_capability('moodle/site:viewuseridentity', $coursecontext);
475+
return has_capability('moodle/site:viewuseridentity', $coursecontext) ||
476+
has_capability('moodle/user:viewalldetails', $context);
478477
}
479478
case PROFILE_VISIBLE_ALL:
480479
return true;

0 commit comments

Comments
 (0)