1 |
efrain |
1 |
@core @javascript
|
|
|
2 |
Feature: Override permissions on a context
|
|
|
3 |
In order to extend and restrict moodle features
|
|
|
4 |
As an admin or a teacher
|
|
|
5 |
I need to allow/deny the existing capabilities at different levels
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | t1@example.com |
|
|
|
11 |
And the following "courses" exist:
|
|
|
12 |
| fullname | shortname | enablecompletion |
|
|
|
13 |
| Course 1 | C1 | 1 |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| teacher1 | C1 | editingteacher |
|
|
|
17 |
|
|
|
18 |
Scenario: Default system capabilities modification
|
|
|
19 |
Given I am on the "C1" "permissions" page logged in as "admin"
|
|
|
20 |
When I click on "Allow" "icon" in the "mod/forum:addnews" "table_row"
|
|
|
21 |
And I press "Student"
|
|
|
22 |
Then "Add announcementsmod/forum:addnews" row "Roles with permission" column of "permissions" table should contain "Student"
|
|
|
23 |
When I reload the page
|
|
|
24 |
And I click on "Delete Student role" "link" in the "mod/forum:addnews" "table_row"
|
|
|
25 |
And I click on "Remove" "button" in the "Confirm role change" "dialogue"
|
|
|
26 |
Then "Add announcementsmod/forum:addnews" row "Roles with permission" column of "permissions" table should not contain "Student"
|
|
|
27 |
When I reload the page
|
|
|
28 |
And I click on "Prohibit" "icon" in the "mod/forum:addnews" "table_row"
|
|
|
29 |
And I press "Student"
|
|
|
30 |
Then "Add announcementsmod/forum:addnews" row "Prohibited" column of "permissions" table should contain "Student"
|
|
|
31 |
|
|
|
32 |
Scenario: Module capabilities overrides
|
|
|
33 |
Given the following "activity" exists:
|
|
|
34 |
| course | C1 |
|
|
|
35 |
| activity | forum |
|
|
|
36 |
| name | Forum 1 |
|
|
|
37 |
And I am on the "Forum 1" "forum activity permissions" page logged in as admin
|
|
|
38 |
When I click on "Allow" "icon" in the "mod/forum:addnews" "table_row"
|
|
|
39 |
And I press "Student"
|
|
|
40 |
Then "Add announcementsmod/forum:addnews" row "Roles with permission" column of "permissions" table should contain "Student"
|
|
|
41 |
When I reload the page
|
|
|
42 |
And I click on "Delete Student role" "link" in the "mod/forum:addnews" "table_row"
|
|
|
43 |
And I click on "Remove" "button" in the "Confirm role change" "dialogue"
|
|
|
44 |
Then "Add announcementsmod/forum:addnews" row "Roles with permission" column of "permissions" table should not contain "Student"
|
|
|
45 |
When I reload the page
|
|
|
46 |
And I click on "Prohibit" "icon" in the "mod/forum:addnews" "table_row"
|
|
|
47 |
And I press "Student"
|
|
|
48 |
Then "Add announcementsmod/forum:addnews" row "Prohibited" column of "permissions" table should contain "Student"
|
|
|
49 |
|
|
|
50 |
Scenario: Dates, completion and description are not shown in permission and override pages
|
|
|
51 |
Given the following "activity" exists:
|
|
|
52 |
| course | C1 |
|
|
|
53 |
| activity | feedback |
|
|
|
54 |
| name | Test Feedback |
|
|
|
55 |
| intro | Test feedback description |
|
|
|
56 |
| completion | 1 |
|
|
|
57 |
| timeopen | ##1 Jan 2040 08:00## |
|
|
|
58 |
And I am on the "Test Feedback" "feedback activity" page logged in as teacher1
|
|
|
59 |
And I should see "Test feedback description"
|
|
|
60 |
And "Mark as done" "button" should exist
|
|
|
61 |
And I should see "1 January 2040"
|
|
|
62 |
When I am on the "Test Feedback" "feedback activity permissions" page
|
|
|
63 |
Then I should not see "Test feedback description"
|
|
|
64 |
And "Mark as done" "button" should not exist
|
|
|
65 |
And I should not see "1 January 2040"
|
|
|
66 |
And I set the field "Advanced role override" to "Student"
|
|
|
67 |
And I should not see "Test feedback description"
|
|
|
68 |
And "Mark as done" "button" should not exist
|
|
|
69 |
And I should not see "1 January 2040"
|