Skip to content

Commit e5956fb

Browse files
committed
MDL-85811 user_profile: refine capability checks for viewing user details
Supporting teacher view
1 parent 9551802 commit e5956fb

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)