I have a basic understanding on the privacy api and I can test the original functions, but I am out of ideas on how to test the new functions:
Who is triggering this 2 functions and when?
I understand for example 'delete_data_for_users' is triggered when an activity instance is deleted like a quiz or a survey or the user(s) is deleted and the data in the activity is deleted. Is my assumption correct?
These two functions are called by the core Privacy API in Moodle 3.6, 3.5.3, and 3.4.6.
They are used to identify which users have data in a context, and to delete data for multiple users. This allows facilitation of a staggered deletion so that different retention periods can be set for different types of users. For example to allow content belonging to Teachers to be kept for longer than for students.
The best way to test these is by writing unit tests.
At the moment I haven't written any utilities for this, though it would be relatively easy to do so.
I am having the same trouble with working out how to support the following method for a plugin I help maintain.
The plugin (enrolment) has user data in two contexts USER and COURSE.
What types of contexts get added to approved_userlist and passed to this method?
Do I just need to support a course context? I wouldn't expect a userlist with user context to be passed to delete_data_for_users() as a single user deletion would be handled by delete_data_for_user()?