1 |
efrain |
1 |
@tool @tool_dataprivacy
|
|
|
2 |
Feature: Data export from the privacy API
|
|
|
3 |
In order to export data for users and meet legal requirements
|
|
|
4 |
As an admin, user, or parent
|
|
|
5 |
I need to be able to export data for a user
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | institution |
|
|
|
10 |
| victim | Victim User | 1 | University1 |
|
|
|
11 |
| victim2 | Victim User | 2 | University2 |
|
|
|
12 |
| requester | The | Requester | University3 |
|
|
|
13 |
| parent | Long-suffering | Parent | |
|
|
|
14 |
And the following "roles" exist:
|
|
|
15 |
| shortname | name | archetype |
|
|
|
16 |
| tired | Tired | |
|
|
|
17 |
And the following "permission overrides" exist:
|
|
|
18 |
| capability | permission | role | contextlevel | reference |
|
|
|
19 |
| tool/dataprivacy:makedatarequestsforchildren | Allow | tired | System | |
|
|
|
20 |
| tool/dataprivacy:managedatarequests | Allow | manager | System | |
|
|
|
21 |
| moodle/site:viewuseridentity | Prevent | manager | System | |
|
|
|
22 |
And the following "role assigns" exist:
|
|
|
23 |
| user | role | contextlevel | reference |
|
|
|
24 |
| parent | tired | User | victim |
|
|
|
25 |
And the following "system role assigns" exist:
|
|
|
26 |
| user | role | contextlevel |
|
|
|
27 |
| requester | manager | User |
|
|
|
28 |
And the following config values are set as admin:
|
|
|
29 |
| contactdataprotectionofficer | 1 | tool_dataprivacy |
|
|
|
30 |
| privacyrequestexpiry | 55 | tool_dataprivacy |
|
|
|
31 |
| dporoles | 1 | tool_dataprivacy |
|
|
|
32 |
And the following data privacy "categories" exist:
|
|
|
33 |
| name |
|
|
|
34 |
| Site category |
|
|
|
35 |
And the following data privacy "purposes" exist:
|
|
|
36 |
| name | retentionperiod |
|
|
|
37 |
| Site purpose | P10Y |
|
|
|
38 |
And I set the site category and purpose to "Site category" and "Site purpose"
|
|
|
39 |
|
|
|
40 |
@javascript
|
|
|
41 |
Scenario: As admin, export data for a user and download it, unless it has expired
|
|
|
42 |
Given I log in as "admin"
|
|
|
43 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
44 |
And I follow "New request"
|
|
|
45 |
And I set the field "User" to "Victim User 1"
|
|
|
46 |
And I press "Save changes"
|
|
|
47 |
Then I should see "Victim User 1"
|
|
|
48 |
And I should see "Awaiting approval" in the "Victim User 1" "table_row"
|
|
|
49 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
50 |
And I follow "Approve request"
|
|
|
51 |
And I press "Approve request"
|
|
|
52 |
And I should see "Approved" in the "Victim User 1" "table_row"
|
|
|
53 |
And I run all adhoc tasks
|
|
|
54 |
And I reload the page
|
|
|
55 |
And I should see "Download ready" in the "Victim User 1" "table_row"
|
|
|
56 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
57 |
And following "Download" should download between "1" and "200000" bytes
|
|
|
58 |
And the following config values are set as admin:
|
|
|
59 |
| privacyrequestexpiry | 1 | tool_dataprivacy |
|
|
|
60 |
And I wait "1" seconds
|
|
|
61 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
62 |
And I should see "Expired" in the "Victim User 1" "table_row"
|
|
|
63 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
64 |
And I should not see "Download"
|
|
|
65 |
|
|
|
66 |
@javascript
|
|
|
67 |
Scenario: As a student, request data export and then download it when approved, unless it has expired
|
|
|
68 |
Given I log in as "victim"
|
|
|
69 |
And I follow "Profile" in the user menu
|
|
|
70 |
And I follow "Data requests"
|
|
|
71 |
And I follow "New request"
|
|
|
72 |
And I press "Save changes"
|
|
|
73 |
Then I should see "Export all of my personal data"
|
|
|
74 |
And I should see "Awaiting approval" in the "Export all of my personal data" "table_row"
|
|
|
75 |
|
|
|
76 |
And I log out
|
|
|
77 |
And I log in as "admin"
|
|
|
78 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
79 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
80 |
And I follow "Approve request"
|
|
|
81 |
And I press "Approve request"
|
|
|
82 |
|
|
|
83 |
And I log out
|
|
|
84 |
And I log in as "victim"
|
|
|
85 |
And I follow "Profile" in the user menu
|
|
|
86 |
And I follow "Data requests"
|
|
|
87 |
And I should see "Approved" in the "Export all of my personal data" "table_row"
|
|
|
88 |
And I run all adhoc tasks
|
|
|
89 |
And I reload the page
|
|
|
90 |
And I should see "Download ready" in the "Export all of my personal data" "table_row"
|
|
|
91 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
92 |
And following "Download" should download between "1" and "200000" bytes
|
|
|
93 |
|
|
|
94 |
And the following config values are set as admin:
|
|
|
95 |
| privacyrequestexpiry | 1 | tool_dataprivacy |
|
|
|
96 |
And I wait "1" seconds
|
|
|
97 |
And I reload the page
|
|
|
98 |
|
|
|
99 |
And I should see "Expired" in the "Export all of my personal data" "table_row"
|
|
|
100 |
And I should not see "Actions"
|
|
|
101 |
|
|
|
102 |
@javascript
|
|
|
103 |
Scenario: As a parent, request data export for my child because I don't trust the little blighter
|
|
|
104 |
Given I log in as "parent"
|
|
|
105 |
And I follow "Profile" in the user menu
|
|
|
106 |
And I follow "Data requests"
|
|
|
107 |
And I follow "New request"
|
|
|
108 |
And I set the field "User" to "Victim User 1"
|
|
|
109 |
And I press "Save changes"
|
|
|
110 |
Then I should see "Victim User 1"
|
|
|
111 |
And I should see "Awaiting approval" in the "Victim User 1" "table_row"
|
|
|
112 |
|
|
|
113 |
And I log out
|
|
|
114 |
And I log in as "admin"
|
|
|
115 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
116 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
117 |
And I follow "Approve request"
|
|
|
118 |
And I press "Approve request"
|
|
|
119 |
|
|
|
120 |
And I log out
|
|
|
121 |
And I log in as "parent"
|
|
|
122 |
And I follow "Profile" in the user menu
|
|
|
123 |
And I follow "Data requests"
|
|
|
124 |
And I should see "Approved" in the "Victim User 1" "table_row"
|
|
|
125 |
And I run all adhoc tasks
|
|
|
126 |
And I reload the page
|
|
|
127 |
And I should see "Download ready" in the "Victim User 1" "table_row"
|
|
|
128 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
129 |
And following "Download" should download between "1" and "200000" bytes
|
|
|
130 |
|
|
|
131 |
And the following config values are set as admin:
|
|
|
132 |
| privacyrequestexpiry | 1 | tool_dataprivacy |
|
|
|
133 |
And I wait "1" seconds
|
|
|
134 |
And I reload the page
|
|
|
135 |
|
|
|
136 |
And I should see "Expired" in the "Victim User 1" "table_row"
|
|
|
137 |
And I should not see "Actions"
|
|
|
138 |
|
|
|
139 |
@javascript
|
|
|
140 |
Scenario: Test search for user using extra field.
|
|
|
141 |
Given the following "permission overrides" exist:
|
|
|
142 |
| capability | permission | role | contextlevel | reference |
|
|
|
143 |
| moodle/site:viewuseridentity | Allow | manager | System | |
|
|
|
144 |
And the following config values are set as admin:
|
|
|
145 |
| showuseridentity | institution |
|
|
|
146 |
And I log in as "requester"
|
|
|
147 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
148 |
And I follow "New request"
|
|
|
149 |
And I set the field "Search" to "University1"
|
|
|
150 |
Then I should see "Victim User 1"
|
|
|
151 |
When I reload the page
|
|
|
152 |
And I set the field "Search" to "University2"
|
|
|
153 |
Then I should see "Victim User 2"
|
|
|
154 |
|
|
|
155 |
Scenario: Request data export as student with automatic approval turned on
|
|
|
156 |
Given the following config values are set as admin:
|
|
|
157 |
| automaticdataexportapproval | 1 | tool_dataprivacy |
|
|
|
158 |
And I log in as "victim"
|
|
|
159 |
And I follow "Profile" in the user menu
|
|
|
160 |
And I follow "Export all of my personal data"
|
|
|
161 |
When I press "Save changes"
|
|
|
162 |
Then I should see "Your request has been submitted and will be processed soon."
|
|
|
163 |
And I should see "Approved" in the "Export all of my personal data" "table_row"
|
|
|
164 |
|
|
|
165 |
@javascript
|
|
|
166 |
Scenario: As admin, enable allow filtering of exports by course setting, export data for a user and download it
|
|
|
167 |
Given the following config values are set as admin:
|
|
|
168 |
| allowfiltering | 1 | tool_dataprivacy |
|
|
|
169 |
And I log in as "admin"
|
|
|
170 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
171 |
And I follow "New request"
|
|
|
172 |
And I set the field "User" to "Victim User 1"
|
|
|
173 |
And I should see "Export my personal data"
|
|
|
174 |
And I press "Save changes"
|
|
|
175 |
Then I should see "Victim User 1"
|
|
|
176 |
And I should see "Pending" in the "Victim User 1" "table_row"
|
|
|
177 |
And I run all adhoc tasks
|
|
|
178 |
And I reload the page
|
|
|
179 |
And I should see "Awaiting approval" in the "Victim User 1" "table_row"
|
|
|
180 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
181 |
And I follow "Approve request (all data)"
|
|
|
182 |
And I press "Approve request"
|
|
|
183 |
And I should see "Approved" in the "Victim User 1" "table_row"
|
|
|
184 |
And I run all adhoc tasks
|
|
|
185 |
And I reload the page
|
|
|
186 |
And I should see "Download ready" in the "Victim User 1" "table_row"
|
|
|
187 |
And I open the action menu in "Victim User 1" "table_row"
|
11 |
efrain |
188 |
And following "Download" should download between "1" and "172000" bytes
|
1 |
efrain |
189 |
And the following config values are set as admin:
|
|
|
190 |
| privacyrequestexpiry | 1 | tool_dataprivacy |
|
|
|
191 |
And I wait "1" seconds
|
|
|
192 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
193 |
And I should see "Expired" in the "Victim User 1" "table_row"
|
|
|
194 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
195 |
And I should not see "Download"
|
|
|
196 |
|
|
|
197 |
@javascript
|
|
|
198 |
Scenario: As admin, enable allow filtering of exports by course setting, filter before export data for a user and download it
|
|
|
199 |
Given the following "courses" exist:
|
|
|
200 |
| fullname | shortname |
|
|
|
201 |
| Course 1 | C1 |
|
|
|
202 |
| Course 2 | C2 |
|
|
|
203 |
| Coruse 3 | C3 |
|
|
|
204 |
And the following "course enrolments" exist:
|
|
|
205 |
| user | course | role |
|
|
|
206 |
| victim | C1 | student |
|
|
|
207 |
| victim | C2 | student |
|
|
|
208 |
And the following config values are set as admin:
|
|
|
209 |
| allowfiltering | 1 | tool_dataprivacy |
|
|
|
210 |
And I log in as "admin"
|
|
|
211 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
212 |
And I follow "New request"
|
|
|
213 |
And I set the field "User" to "Victim User 1"
|
|
|
214 |
And I press "Save changes"
|
|
|
215 |
Then I should see "Victim User 1"
|
|
|
216 |
And I run all adhoc tasks
|
|
|
217 |
And I reload the page
|
|
|
218 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
219 |
And I follow "Approve request (data from selected courses)"
|
|
|
220 |
And I should see "Course 1"
|
|
|
221 |
And I should see "Course 2"
|
|
|
222 |
And I should not see "Course 3"
|
|
|
223 |
And I press "Approve request"
|
|
|
224 |
And I should see "You must select at least one course"
|
|
|
225 |
And I set the field "Select courses to export" to "Course 1"
|
|
|
226 |
And I press "Approve request"
|
|
|
227 |
And I should see "Approved" in the "Victim User 1" "table_row"
|
|
|
228 |
And I run all adhoc tasks
|
|
|
229 |
And I reload the page
|
|
|
230 |
And I should see "Download ready" in the "Victim User 1" "table_row"
|
|
|
231 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
232 |
And following "Download" should download between "1" and "180000" bytes
|
|
|
233 |
|
|
|
234 |
@javascript
|
|
|
235 |
Scenario: Filter before export data for a user and download it in the view request action
|
|
|
236 |
Given the following "courses" exist:
|
|
|
237 |
| fullname | shortname |
|
|
|
238 |
| Course 1 | C1 |
|
|
|
239 |
| Course 2 | C2 |
|
|
|
240 |
| Coruse 3 | C3 |
|
|
|
241 |
And the following "course enrolments" exist:
|
|
|
242 |
| user | course | role |
|
|
|
243 |
| victim | C1 | student |
|
|
|
244 |
| victim | C2 | student |
|
|
|
245 |
And the following config values are set as admin:
|
|
|
246 |
| allowfiltering | 1 | tool_dataprivacy |
|
|
|
247 |
And I log in as "admin"
|
|
|
248 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
249 |
And I follow "New request"
|
|
|
250 |
And I set the field "User" to "Victim User 1"
|
|
|
251 |
And I press "Save changes"
|
|
|
252 |
Then I should see "Victim User 1"
|
|
|
253 |
And I run all adhoc tasks
|
|
|
254 |
And I reload the page
|
|
|
255 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
256 |
And I follow "View the request"
|
|
|
257 |
And I press "Approve selected courses"
|
|
|
258 |
And I set the field "Select courses to export" to "Course 1"
|
|
|
259 |
And I press "Approve request"
|
|
|
260 |
And I should see "Approved" in the "Victim User 1" "table_row"
|
|
|
261 |
And I run all adhoc tasks
|
|
|
262 |
And I reload the page
|
|
|
263 |
And I should see "Download ready" in the "Victim User 1" "table_row"
|
|
|
264 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
265 |
And following "Download" should download between "1" and "180000" bytes
|