mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-74205 navigation: Don't show participants link to user if he has no permission.
This commit is contained in:
parent
efda17d3b0
commit
053785ff5f
@ -37,6 +37,35 @@ Feature: Displaying the link to the Participants page
|
||||
And "Student One" "link" should exist
|
||||
And "Student Two" "link" should not exist
|
||||
|
||||
@javascript
|
||||
Scenario: Course participants link is displayed to users depending on role permissions settings
|
||||
And I log in as "admin"
|
||||
And I am on "Course1" course homepage with editing mode on
|
||||
And I add a "Forum" to section "1" and I fill the form with:
|
||||
| Forum name | Test forum name |
|
||||
| Description | Test forum description |
|
||||
And I am on the "Course1" "enrolment methods" page
|
||||
And I click on "Edit" "link" in the "Guest access" "table_row"
|
||||
And I set the following fields to these values:
|
||||
| Allow guest access | Yes |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
When I log in as "guest"
|
||||
And I am on "Course1" course homepage
|
||||
Then I should not see "Participants" in the "Navigation" "block"
|
||||
And I am on the "Test forum name" "forum activity" page
|
||||
And I should not see "Participants" in the "Navigation" "block"
|
||||
And I log out
|
||||
And I log in as "admin"
|
||||
And I set the following system permissions of "Guest" role:
|
||||
| capability | permission |
|
||||
| moodle/course:viewparticipants | Allow |
|
||||
And I log in as "guest"
|
||||
And I am on "Course1" course homepage
|
||||
And I should see "Participants" in the "Navigation" "block"
|
||||
And I am on the "Test forum name" "forum activity" page
|
||||
And I should see "Participants" in the "Navigation" "block"
|
||||
|
||||
Scenario: Site participants link is displayed to admins
|
||||
When I log in as "admin"
|
||||
Then "Participants" "link" should exist in the "Navigation" "block"
|
||||
|
@ -2939,8 +2939,8 @@ class global_navigation extends navigation_node {
|
||||
if ($navoptions->notes) {
|
||||
$participants->add(get_string('notes', 'notes'), new moodle_url('/notes/index.php', array('filtertype' => 'course', 'filterselect' => $course->id)), self::TYPE_SETTING, null, 'currentcoursenotes');
|
||||
}
|
||||
} else if (count($this->extendforuser) > 0 || $this->page->course->id == $course->id) {
|
||||
$participants = $coursenode->add(get_string('participants'), null, self::TYPE_CONTAINER, get_string('participants'), 'participants');
|
||||
} else if (count($this->extendforuser) > 0) {
|
||||
$coursenode->add(get_string('participants'), null, self::TYPE_CONTAINER, get_string('participants'), 'participants');
|
||||
}
|
||||
|
||||
// Badges.
|
||||
|
Loading…
x
Reference in New Issue
Block a user