Skip to content

Commit

Permalink
Merge branch 'MDL-66648-38' of https://github.com/paulholden/moodle i…
Browse files Browse the repository at this point in the history
…nto MOODLE_38_STABLE
  • Loading branch information
stronk7 committed Sep 21, 2020
2 parents 5b2fb79 + 92111f0 commit f710fba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 1 addition & 3 deletions lib/myprofilelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ function core_myprofile_navigation(core_user\output\myprofile\tree $tree, $user,
// Add core nodes.
// Full profile node.
if (!empty($course)) {
if (empty($CFG->forceloginforprofiles) || $iscurrentuser ||
has_capability('moodle/user:viewdetails', $usercontext)
|| has_coursecontact_role($user->id)) {
if (user_can_view_profile($user, null, $usercontext)) {
$url = new moodle_url('/user/profile.php', array('id' => $user->id));
$node = new core_user\output\myprofile\node('miscellaneous', 'fullprofile', get_string('fullprofile'), null, $url);
$tree->add_node($node);
Expand Down
12 changes: 10 additions & 2 deletions user/tests/behat/view_full_profile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ Feature: Access to full profiles of users

Scenario: Viewing full profiles with default settings
When I log in as "student1"
# Another student's full profile is visible
And I am on "Course 1" course homepage
# Another student's full profile is not visible
And I navigate to course participants
And I follow "Student 2"
Then I should not see "Full profile"
Then I should see "Full profile"
# Teacher's full profile is visible
And I am on "Course 1" course homepage
And I navigate to course participants
Expand Down Expand Up @@ -66,6 +66,14 @@ Feature: Access to full profiles of users
And I follow "Full profile"
Then I should see "First access to site"

Scenario: Viewing full profiles of students as a teacher
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to course participants
And I follow "Student 1"
And I follow "Full profile"
Then I should see "First access to site"

Scenario: Viewing own full profile
Given I log in as "student1"
When I follow "Profile" in the user menu
Expand Down

0 comments on commit f710fba

Please sign in to comment.