MDL-66648 user: consistent checks for linking to full profile.
The access checks for displaying a link to a users' full profile now match the checks performed on the full profile page itself.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user