AutorÃa | Ultima modificación | Ver Log |
@core @core_courseFeature: Access to downloading course content can be controlledIn order to allow or restrict access to download course contentAs a trusted userI can control access to the download course content featureBackground:Given the following "users" exist:| username | firstname | lastname | email || teacher1 | Teacher | 1 | teacher1@example.com || student1 | Student | 1 | student1@example.com |And the following "courses" exist:| fullname | shortname || Hockey 101 | C1 |And the following "course enrolments" exist:| user | course | role || teacher1 | C1 | editingteacher || student1 | C1 | student |And the following config values are set as admin:| downloadcoursecontentallowed | 1 |Scenario: Site admins can remove the download course content featureGiven I log in as "admin"And I am on "Hockey 101" course homepageAnd I navigate to "Settings" in current page administrationAnd I set the field "Enable download course content" to "Yes"And I press "Save and display"Then "Download course content" "link" should exist in current page administrationWhen the following config values are set as admin:| downloadcoursecontentallowed | 0 |And I am on "Hockey 101" course homepageThen "Download course content" "link" should not exist in current page administrationAnd I navigate to "Settings" in current page administrationAnd I should not see "Enable download course content"Scenario: Site admins can set the default value for whether download course content is enabled in coursesGiven I log in as "admin"And I am on "Hockey 101" course homepageAnd "Download course content" "link" should not exist in current page administrationWhen I navigate to "Courses > Default settings > Course default settings" in site administrationAnd I set the field "Enable download course content" to "Yes"And I press "Save changes"And I am on "Hockey 101" course homepageThen "Download course content" "link" should exist in current page administrationScenario: A teacher can enable and disable the download course content feature when it is availableGiven I log in as "teacher1"When I am on "Hockey 101" course homepageAnd "Download course content" "link" should not exist in current page administrationAnd I navigate to "Settings" in current page administrationAnd I should see "Enable download course content"And I set the field "Enable download course content" to "Yes"And I press "Save and display"Then "Download course content" "link" should exist in current page administrationAnd I navigate to "Settings" in current page administrationAnd I set the field "Enable download course content" to "No"And I press "Save and display"Then "Download course content" "link" should not exist in current page administrationScenario: Teachers require a capability to access the download course content feature or modify its availability in a courseGiven the following config values are set as admin:| config | value | plugin || downloadcontentsitedefault | 1 | moodlecourse |# Check teacher can see download option and enable dropdown.And I log in as "teacher1"And I am on "Hockey 101" course homepageThen "Download course content" "link" should exist in current page administrationAnd I navigate to "Settings" in current page administrationAnd "Enable download course content" "select" should exist# Remove teacher's capabilities for download course content.And the following "role capability" exists:| role | editingteacher || moodle/course:downloadcoursecontent | prohibit || moodle/course:configuredownloadcontent | prohibit |# Check teacher can no longer see download option, and that enable value is visible, but dropdown no longer available.When I log in as "teacher1"And I am on "Hockey 101" course homepageThen "Download course content" "link" should not exist in current page administrationAnd I navigate to "Settings" in current page administrationAnd I should see "Enable download course content"And I should see "Site default (Yes)"And "Enable download course content" "select" should not existScenario: Students require a capability to access the download course content feature in a courseGiven I log in as "teacher1"And I am on "Hockey 101" course homepageAnd I navigate to "Settings" in current page administrationAnd I set the field "Enable download course content" to "Yes"And I press "Save and display"And I log out# Check student can see the download link.And I log in as "student1"And I am on "Hockey 101" course homepageAnd "Download course content" "link" should exist in current page administration# Remove student's capability for download course content.When the following "role capability" exists:| role | student || moodle/course:downloadcoursecontent | prohibit |# Check student can no longer see the download link.And I log in as "student1"And I am on "Hockey 101" course homepageThen "Download course content" "link" should not exist in current page administration