1 |
efrain |
1 |
@tool @tool_dataprivacy
|
|
|
2 |
Feature: Data delete from the privacy API
|
|
|
3 |
In order to delete data for users and meet legal requirements
|
|
|
4 |
As an admin, user, or parent
|
|
|
5 |
I need to be able to request a user and their data data be deleted
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname |
|
|
|
10 |
| victim | Victim User | 1 |
|
|
|
11 |
| parent | Long-suffering | Parent |
|
|
|
12 |
| privacyofficer | Privacy Officer | One |
|
|
|
13 |
And the following "roles" exist:
|
|
|
14 |
| shortname | name | archetype |
|
|
|
15 |
| tired | Tired | |
|
|
|
16 |
And the following "permission overrides" exist:
|
|
|
17 |
| capability | permission | role | contextlevel | reference |
|
|
|
18 |
| tool/dataprivacy:makedatarequestsforchildren | Allow | tired | System | |
|
|
|
19 |
| tool/dataprivacy:makedatadeletionrequestsforchildren | Allow | tired | System | |
|
|
|
20 |
| tool/dataprivacy:managedatarequests | Allow | manager | System | |
|
|
|
21 |
And the following "role assigns" exist:
|
|
|
22 |
| user | role | contextlevel | reference |
|
|
|
23 |
| parent | tired | User | victim |
|
|
|
24 |
And the following "system role assigns" exist:
|
|
|
25 |
| user | role | contextlevel |
|
|
|
26 |
| privacyofficer | manager | User |
|
|
|
27 |
And the following config values are set as admin:
|
|
|
28 |
| contactdataprotectionofficer | 1 | tool_dataprivacy |
|
|
|
29 |
And the following data privacy "categories" exist:
|
|
|
30 |
| name |
|
|
|
31 |
| Site category |
|
|
|
32 |
And the following data privacy "purposes" exist:
|
|
|
33 |
| name | retentionperiod |
|
|
|
34 |
| Site purpose | P10Y |
|
|
|
35 |
And the following config values are set as admin:
|
|
|
36 |
| contactdataprotectionofficer | 1 | tool_dataprivacy |
|
|
|
37 |
| privacyrequestexpiry | 55 | tool_dataprivacy |
|
|
|
38 |
| dporoles | 1 | tool_dataprivacy |
|
|
|
39 |
And I set the site category and purpose to "Site category" and "Site purpose"
|
|
|
40 |
|
|
|
41 |
@javascript
|
|
|
42 |
Scenario: As admin, delete a user and their data
|
|
|
43 |
Given I log in as "victim"
|
|
|
44 |
And I should see "Victim User 1"
|
|
|
45 |
And I log out
|
|
|
46 |
|
|
|
47 |
And I log in as "admin"
|
|
|
48 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
49 |
And I follow "New request"
|
|
|
50 |
And I set the field "User" to "Victim User 1"
|
|
|
51 |
And I set the field "Type" to "Delete all of my personal data"
|
|
|
52 |
And I press "Save changes"
|
|
|
53 |
Then I should see "Victim User 1"
|
|
|
54 |
And I should see "Awaiting approval" in the "Victim User 1" "table_row"
|
|
|
55 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
56 |
And I follow "Approve request"
|
|
|
57 |
And I press "Approve request"
|
|
|
58 |
And I should see "Approved" in the "Victim User 1" "table_row"
|
|
|
59 |
And I run all adhoc tasks
|
|
|
60 |
And I reload the page
|
|
|
61 |
And I should see "Deleted" in the "Victim User 1" "table_row"
|
|
|
62 |
|
|
|
63 |
And I log out
|
|
|
64 |
And I log in as "victim"
|
|
|
65 |
And I should see "Invalid login"
|
|
|
66 |
|
|
|
67 |
@javascript
|
|
|
68 |
Scenario: As a student, request deletion of account and data
|
|
|
69 |
Given I log in as "victim"
|
|
|
70 |
And I follow "Profile" in the user menu
|
|
|
71 |
And I follow "Data requests"
|
|
|
72 |
And I follow "New request"
|
|
|
73 |
And I set the field "Type" to "Delete all of my personal data"
|
|
|
74 |
And I press "Save changes"
|
|
|
75 |
Then I should see "Delete all of my personal data"
|
|
|
76 |
And I should see "Awaiting approval" in the "Delete all of my personal data" "table_row"
|
|
|
77 |
|
|
|
78 |
And I log out
|
|
|
79 |
And I log in as "admin"
|
|
|
80 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
81 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
82 |
And I follow "Approve request"
|
|
|
83 |
And I press "Approve request"
|
|
|
84 |
|
|
|
85 |
And I log out
|
|
|
86 |
And I log in as "victim"
|
|
|
87 |
And I follow "Profile" in the user menu
|
|
|
88 |
And I follow "Data requests"
|
|
|
89 |
And I should see "Approved" in the "Delete all of my personal data" "table_row"
|
|
|
90 |
And I run all adhoc tasks
|
|
|
91 |
And I reload the page
|
|
|
92 |
And I should see "Your session has timed out"
|
|
|
93 |
And I log in as "victim"
|
|
|
94 |
And I should see "Invalid login"
|
|
|
95 |
|
|
|
96 |
And I log in as "admin"
|
|
|
97 |
And I am on site homepage
|
|
|
98 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
99 |
And I should see "Deleted"
|
|
|
100 |
|
|
|
101 |
@javascript
|
|
|
102 |
Scenario: As a parent, request account and data deletion for my child
|
|
|
103 |
Given I log in as "parent"
|
|
|
104 |
And I follow "Profile" in the user menu
|
|
|
105 |
And I follow "Data requests"
|
|
|
106 |
And I follow "New request"
|
|
|
107 |
And I set the field "User" to "Victim User 1"
|
|
|
108 |
And I set the field "Type" to "Delete all of my personal data"
|
|
|
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 "You don't have any personal data requests"
|
|
|
128 |
|
|
|
129 |
@javascript
|
|
|
130 |
Scenario: As a Privacy Officer, I cannot create data deletion request unless I have permission.
|
|
|
131 |
Given I log in as "privacyofficer"
|
|
|
132 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
133 |
And I follow "New request"
|
|
|
134 |
And I open the autocomplete suggestions list
|
|
|
135 |
And I click on "Victim User 1" item in the autocomplete list
|
|
|
136 |
Then I should see "Export all of my personal data"
|
|
|
137 |
And "Type" "select" should not be visible
|
|
|
138 |
And the following "permission overrides" exist:
|
|
|
139 |
| capability | permission | role | contextlevel | reference |
|
|
|
140 |
| tool/dataprivacy:requestdeleteforotheruser | Allow | manager | System | |
|
|
|
141 |
And I reload the page
|
|
|
142 |
And I open the autocomplete suggestions list
|
|
|
143 |
And I click on "Victim User 1" item in the autocomplete list
|
|
|
144 |
And "Type" "select" should be visible
|
|
|
145 |
|
|
|
146 |
@javascript
|
|
|
147 |
Scenario: As a student, I cannot create data deletion request unless I have permission.
|
|
|
148 |
Given I log in as "victim"
|
|
|
149 |
And I follow "Profile" in the user menu
|
|
|
150 |
And I follow "Data requests"
|
|
|
151 |
And I follow "New request"
|
|
|
152 |
Then "Type" "select" should exist
|
|
|
153 |
And the following "permission overrides" exist:
|
|
|
154 |
| capability | permission | role | contextlevel | reference |
|
|
|
155 |
| tool/dataprivacy:requestdelete | Prevent | user | System | |
|
|
|
156 |
And I reload the page
|
|
|
157 |
And I should see "Export all of my personal data"
|
|
|
158 |
And "Type" "select" should not exist
|
|
|
159 |
|
|
|
160 |
@javascript
|
|
|
161 |
Scenario: As a parent, I cannot create data deletion request unless I have permission.
|
|
|
162 |
Given I log in as "parent"
|
|
|
163 |
And the following "permission overrides" exist:
|
|
|
164 |
| capability | permission | role | contextlevel | reference |
|
|
|
165 |
| tool/dataprivacy:makedatadeletionrequestsforchildren | Prevent | tired | System | victim |
|
|
|
166 |
And I follow "Profile" in the user menu
|
|
|
167 |
And I follow "Data requests"
|
|
|
168 |
And I follow "New request"
|
|
|
169 |
And I open the autocomplete suggestions list
|
|
|
170 |
And I click on "Victim User 1" item in the autocomplete list
|
|
|
171 |
And I set the field "Type" to "Delete all of my personal data"
|
|
|
172 |
And I press "Save changes"
|
|
|
173 |
And I should see "You don't have permission to create deletion request for this user."
|
|
|
174 |
And the following "permission overrides" exist:
|
|
|
175 |
| capability | permission | role | contextlevel | reference |
|
|
|
176 |
| tool/dataprivacy:makedatadeletionrequestsforchildren | Allow | tired | System | victim |
|
|
|
177 |
| tool/dataprivacy:requestdelete | Prevent | user | System | |
|
|
|
178 |
And I open the autocomplete suggestions list
|
|
|
179 |
And I click on "Long-suffering Parent" item in the autocomplete list
|
|
|
180 |
And I press "Save changes"
|
|
|
181 |
And I should see "You don't have permission to create deletion request for yourself."
|
|
|
182 |
|
|
|
183 |
@javascript
|
|
|
184 |
Scenario: As a student, link to create data deletion should not be shown if I don't have permission.
|
|
|
185 |
Given the following "permission overrides" exist:
|
|
|
186 |
| capability | permission | role | contextlevel | reference |
|
|
|
187 |
| tool/dataprivacy:requestdelete | Prohibit | user | System | |
|
|
|
188 |
When I log in as "victim"
|
|
|
189 |
And I follow "Profile" in the user menu
|
|
|
190 |
Then I should not see "Delete my account"
|
|
|
191 |
|
|
|
192 |
@javascript
|
|
|
193 |
Scenario: As a primary admin, the link to create a data deletion request should not be shown.
|
|
|
194 |
Given I log in as "admin"
|
|
|
195 |
When I follow "Profile" in the user menu
|
|
|
196 |
Then I should not see "Delete my account"
|
|
|
197 |
|
|
|
198 |
@javascript
|
|
|
199 |
Scenario: As a Privacy Officer, I cannot Approve to Deny deletion data request without permission.
|
|
|
200 |
Given the following "permission overrides" exist:
|
|
|
201 |
| capability | permission | role | contextlevel | reference |
|
|
|
202 |
| tool/dataprivacy:requestdeleteforotheruser | Allow | manager | System | |
|
|
|
203 |
When I log in as "privacyofficer"
|
|
|
204 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
205 |
And I follow "New request"
|
|
|
206 |
And I open the autocomplete suggestions list
|
|
|
207 |
And I click on "Victim User 1" item in the autocomplete list
|
|
|
208 |
And I set the field "Type" to "Delete all of my personal data"
|
|
|
209 |
And I press "Save changes"
|
|
|
210 |
And the following "permission overrides" exist:
|
|
|
211 |
| capability | permission | role | contextlevel | reference |
|
|
|
212 |
| tool/dataprivacy:requestdeleteforotheruser | Prohibit | manager | System | |
|
|
|
213 |
And I reload the page
|
|
|
214 |
Then ".selectrequests" "css_element" should not exist
|
|
|
215 |
And I open the action menu in "region-main" "region"
|
|
|
216 |
And I should not see "Approve request"
|
|
|
217 |
And I should not see "Deny request"
|
|
|
218 |
And I choose "View the request" in the open action menu
|
|
|
219 |
And "Approve" "button" should not exist
|
|
|
220 |
And "Deny" "button" should not exist
|
|
|
221 |
|
|
|
222 |
@javascript
|
|
|
223 |
Scenario: As a Privacy Officer, I cannot re-submit deletion data request without permission.
|
|
|
224 |
Given the following "permission overrides" exist:
|
|
|
225 |
| capability | permission | role | contextlevel | reference |
|
|
|
226 |
| tool/dataprivacy:requestdeleteforotheruser | Allow | manager | System | |
|
|
|
227 |
When I log in as "privacyofficer"
|
|
|
228 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
229 |
And I follow "New request"
|
|
|
230 |
And I open the autocomplete suggestions list
|
|
|
231 |
And I click on "Victim User 1" item in the autocomplete list
|
|
|
232 |
And I set the field "Type" to "Delete all of my personal data"
|
|
|
233 |
And I press "Save changes"
|
|
|
234 |
And I open the action menu in "region-main" "region"
|
|
|
235 |
And I follow "Deny request"
|
|
|
236 |
And I press "Deny request"
|
|
|
237 |
And the following "permission overrides" exist:
|
|
|
238 |
| capability | permission | role | contextlevel | reference |
|
|
|
239 |
| tool/dataprivacy:requestdeleteforotheruser | Prohibit | manager | System | |
|
|
|
240 |
And I reload the page
|
|
|
241 |
And I open the action menu in "region-main" "region"
|
|
|
242 |
Then I should not see "Resubmit as new request"
|
|
|
243 |
|
|
|
244 |
Scenario: Request data deletion as student with automatic approval turned on
|
|
|
245 |
Given the following config values are set as admin:
|
|
|
246 |
| automaticdatadeletionapproval | 1 | tool_dataprivacy |
|
|
|
247 |
And I log in as "victim"
|
|
|
248 |
And I follow "Profile" in the user menu
|
|
|
249 |
And I follow "Delete my account"
|
|
|
250 |
When I press "Save changes"
|
|
|
251 |
Then I should see "Your request has been submitted and will be processed soon."
|
|
|
252 |
And I should see "Approved" in the "Delete all of my personal data" "table_row"
|
|
|
253 |
|
|
|
254 |
@javascript
|
|
|
255 |
Scenario: Delete flow stay the same even allow filtering of exports by course setting is enabled.
|
|
|
256 |
Given the following config values are set as admin:
|
|
|
257 |
| allowfiltering | 1 | tool_dataprivacy |
|
|
|
258 |
And I log in as "victim"
|
|
|
259 |
And I should see "Victim User 1"
|
|
|
260 |
And I log out
|
|
|
261 |
|
|
|
262 |
And I log in as "admin"
|
|
|
263 |
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
|
|
264 |
And I follow "New request"
|
|
|
265 |
And I set the field "User" to "Victim User 1"
|
|
|
266 |
And I set the field "Type" to "Delete all of my personal data"
|
|
|
267 |
And I press "Save changes"
|
|
|
268 |
Then I should see "Victim User 1"
|
|
|
269 |
And I should see "Awaiting approval" in the "Victim User 1" "table_row"
|
|
|
270 |
And I open the action menu in "Victim User 1" "table_row"
|
|
|
271 |
And I follow "Approve request"
|
|
|
272 |
And I press "Approve request"
|
|
|
273 |
And I should see "Approved" in the "Victim User 1" "table_row"
|
|
|
274 |
And I run all adhoc tasks
|
|
|
275 |
And I reload the page
|
|
|
276 |
And I should see "Deleted" in the "Victim User 1" "table_row"
|
|
|
277 |
|
|
|
278 |
And I log out
|
|
|
279 |
And I log in as "victim"
|
|
|
280 |
And I should see "Invalid login"
|