Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-62560

Support different retention for different roles in a purpose

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Setup

      1. Create a brand new Moodle site. Don't even login into it. Don't create any courses. Just a straight install.
      2. Run the attached test-63496.php script to create a set of courses, and users.
      3. Login as admin
      4. Navigate to Site administration -> Users -> Data registry
      5. From the Edit menu, choose Purposes
      6. Create the following purposes:
        Name Lawful bases Retention period Protected
        Basic Consent 50 years Protected
        I1 Consent 10 years Protected
        I2 Consent 10 years Protected
        I3 Consent 10 years Unprotected
        I4 Consent 10 years Unprotected
        P1 Consent 1 days Protected
        P2 Consent 1 days Unprotected
        P3 Consent 1 days Unprotected
        P4 Consent 1 days Unprotected
      7. Edit the newly created purposes and add some role overrides:
        Name Student Teacher Manager
        I1 1 days, protected
        I2 1 days, unprotected
        I3 1 days, protected
        I4 1 days, unprotected
        P1
        1 years, protected 5 years, protected
        P2
        1 years, protected 5 years, protected
        P3
        1 years, unprotected 5 years, protected
        P4
        1 years, unprotected 5 years, unprotected
      8. Assign each of the courses, and all of it's children a purpose:
        1. m63496-1-I1: I1
        2. m63496-1-I2: I2
        3. m63496-1-I3: I3
        4. m63496-1-I4: I4
        5. m63496-1-P1: P1
        6. m63496-1-P2: P2
        7. m63496-1-P3: P3
        8. m63496-1-P4: P4
      9. Assign the system the "Basic" purpose
      10. Create a new category and assign this to the system too.

      Subject Deletion Request

      1. Create deletion requests for the first user of each type using the attached test-63496-requests.php script:

        php test-63496-requests.php --usernamefilter='m63496-1-%1'
        

      2. Run cron:

        php admin/cli/cron.php
        

      3. Navigate to Site administration > Users > Privacy and Policies > Data requests
        Note: You may find it easier to test this one user at a time by only approving one deletion, then run the task, and confirm the behaviour for that user
      4. Approve all of the requests
      5. Run cron:

        php admin/cli/cron.php
        

        1. View the forum in each course (Not the announcement forum) and confirm that the post from those users are deleted or not deleted as per:
          Note: = no posts exist for this user
          Note: = some posts still exist for this user
          Course s1 t1 m1 st1 sm1 tm1 o1
          User              
          I1
          I2
          I3
          I4
          P1
          P2
          P3
          P4

      Check Initial expiry info

      1. Run the expired retention period task:

        php admin/tool/task/cli/schedule_task.php --execute="\tool_dataprivacy\task\expired_retention_period"
        

      2. Navigate to the list of data deletions
        1. Confirm that all eight courses are listed
        2. Confirm that courses 1, 2, 3, and 4 state:
          1. Default retention period: 10 Years (Unexpired)
          2. Student retention period: 1 days (Expired)
          3. Only data for students will be deleted
        3. Confirm that courses 5, 6, 7, and 8 state:
          1. Default retention period: 1 days (Expired)
          2. Manager retention period: 5 years (Unexpired)
          3. Teacher retention period: 1 years (Unexpired)
          4. Data for all users except for Managers and Teachers will be removed

      Run initial expiry

      Note: You may find it easier to test this one course at a time by only approving one deletion, then run the taks, and confirm the behaviour for that course.

      1. Approve the deletions
      2. Run the expired context deletion task:

        php admin/tool/task/cli/schedule_task.php --execute="\tool_dataprivacy\task\delete_expired_contexts"
        

        1. View the forum in each course (Not the announcement forum) and confirm that the post from those users are deleted or not deleted as per:
          Note: = no posts exist for this type of user
          Note: = some posts exist for this type of user
          Course s* t* m* st* sm* tm* o*
          User e              
          I1
          I2
          I3
          I4
          P1
          P2
          P3
          P4

      Time has passed

      1. For each of the eight courses, change the year to 2017 (they will now be just over one year ago)
        #

        Subject Deletion Request

      2. Create deletion requests for the second user of each type using the attached test-63496-requests.php script:

        php test-63496-requests.php --usernamefilter='m63496-1-%2'
        

      3. Run cron:

        php admin/cli/cron.php
        

      4. Navigate to Site administration > Users > Privacy and Policies > Data requests
        Note: You may find it easier to test this one user at a time by only approving one deletion, then run the task, and confirm the behaviour for that user
      5. Approve all of the requests
      6. Run cron:

        php admin/cli/cron.php
        

        1. View the forum in each course (Not the announcement forum) and confirm that the post from those users are deleted or not deleted as per:
          Note: = no posts exist for this user
          Note: = some posts still exist for this user
          Course t2 m2 st2 sm2 tm2 o2
          User            
          I1
          I2
          I3
          I4
          P1
          P2
          P3
          P4

      Check Expiry info

      1. Run the expired retention period task:

        php admin/tool/task/cli/schedule_task.php --execute="\tool_dataprivacy\task\expired_retention_period"
        

      2. Navigate to the list of data deletions
        1. Confirm that only the four 'P' courses are listed
        2. Confirm that they state:
          1. Default retention period: 1 days (Expired)
          2. Manager retention period: 5 years (Unexpired)
          3. Data for all users except for Managers will be removed

      Run expiry task

      Note: You may find it easier to test this one course at a time by only approving one deletion, then run the taks, and confirm the behaviour for that course.

      1. Approve the deletions
      2. Run the expired context deletion task:

        php admin/tool/task/cli/schedule_task.php --execute="\tool_dataprivacy\task\delete_expired_contexts"
        

        1. View the forum in each course (Not the announcement forum) and confirm that the post from those users are deleted or not deleted as per:
          Note: = no posts exist for this type of user
          Note: = some posts exist for this type of user
          Course t* m* st* sm* tm* o*
          User            
          P1
          P2
          P3
          P4

      Time has passed

      1. For each of the eight courses, change the year to 2008 (they will now be just over ten years ago)

      Subject Deletion Request

      1. Create deletion requests for the third user of each type using the attached test-63496-requests.php script:

        php test-63496-requests.php --usernamefilter='m63496-1-%3'
        

      2. Run cron:

        php admin/cli/cron.php
        

      3. Navigate to Site administration > Users > Privacy and Policies > Data requests
        Note: You may find it easier to test this one user at a time by only approving one deletion, then run the task, and confirm the behaviour for that user
      4. Approve all of the requests
      5. Run cron:

        php admin/cli/cron.php
        

      6. View the forum in each course
        1. Confirm that none of the '3' users have any content left
          Note: = no posts exist for this user
          Note: = some posts still exist for this user
          Course t3 m3 st3 sm3 tm3 o3
          User            
          I1
          I2
          I3
          I4
          P1
          P2
          P3
          P4

      Check Expiry info

      1. Run the expired retention period task:

        php admin/tool/task/cli/schedule_task.php --execute="\tool_dataprivacy\task\expired_retention_period"
        

      2. Navigate to the list of data deletions
        1. Confirm that all eight courses are listed
        2. Confirm that courses all of the I courses state:
          1. Default retention period: 10 Years (Expired)
          2. Delete data for all users
        3. Confirm that courses P courses state:
          1. Default retention period: 1 days (Expired)
          2. Delete data for all users

      Run expiry task

      Note: You may find it easier to test this one course at a time by only approving one deletion, then run the taks, and confirm the behaviour for that course.

      1. Approve the deletions
      2. Run the expired context deletion task:

        php admin/tool/task/cli/schedule_task.php --execute="\tool_dataprivacy\task\delete_expired_contexts"
        

      3. View the forum in each course
        1. Confirm that there are no discussions
      4. View the Participants page in each course
        1. Confirm that there are no participants
      Show
      Setup Create a brand new Moodle site. Don't even login into it. Don't create any courses. Just a straight install. Run the attached test-63496.php script to create a set of courses, and users. Login as admin Navigate to Site administration -> Users -> Data registry From the Edit menu, choose Purposes Create the following purposes: Name Lawful bases Retention period Protected Basic Consent 50 years Protected I1 Consent 10 years Protected I2 Consent 10 years Protected I3 Consent 10 years Unprotected I4 Consent 10 years Unprotected P1 Consent 1 days Protected P2 Consent 1 days Unprotected P3 Consent 1 days Unprotected P4 Consent 1 days Unprotected Edit the newly created purposes and add some role overrides: Name Student Teacher Manager I1 1 days, protected I2 1 days, unprotected I3 1 days, protected I4 1 days, unprotected P1 1 years, protected 5 years, protected P2 1 years, protected 5 years, protected P3 1 years, unprotected 5 years, protected P4 1 years, unprotected 5 years, unprotected Assign each of the courses, and all of it's children a purpose: m63496-1-I1: I1 m63496-1-I2: I2 m63496-1-I3: I3 m63496-1-I4: I4 m63496-1-P1: P1 m63496-1-P2: P2 m63496-1-P3: P3 m63496-1-P4: P4 Assign the system the "Basic" purpose Create a new category and assign this to the system too. Subject Deletion Request Create deletion requests for the first user of each type using the attached test-63496-requests.php script: php test-63496-requests.php --usernamefilter='m63496-1-%1' Run cron: php admin/cli/cron.php Navigate to Site administration > Users > Privacy and Policies > Data requests Note: You may find it easier to test this one user at a time by only approving one deletion, then run the task, and confirm the behaviour for that user Approve all of the requests Run cron: php admin/cli/cron.php View the forum in each course (Not the announcement forum) and confirm that the post from those users are deleted or not deleted as per : Note: = no posts exist for this user Note: = some posts still exist for this user Course s1 t1 m1 st1 sm1 tm1 o1 User               I1 I2 I3 I4 P1 P2 P3 P4 Check Initial expiry info Run the expired retention period task: php admin/tool/task/cli/schedule_task.php --execute="\tool_dataprivacy\task\expired_retention_period" Navigate to the list of data deletions Confirm that all eight courses are listed Confirm that courses 1, 2, 3, and 4 state: Default retention period: 10 Years (Unexpired) Student retention period: 1 days (Expired) Only data for students will be deleted Confirm that courses 5, 6, 7, and 8 state: Default retention period: 1 days (Expired) Manager retention period: 5 years (Unexpired) Teacher retention period: 1 years (Unexpired) Data for all users except for Managers and Teachers will be removed Run initial expiry Note: You may find it easier to test this one course at a time by only approving one deletion, then run the taks, and confirm the behaviour for that course. Approve the deletions Run the expired context deletion task: php admin/tool/task/cli/schedule_task.php --execute="\tool_dataprivacy\task\delete_expired_contexts" View the forum in each course (Not the announcement forum) and confirm that the post from those users are deleted or not deleted as per : Note: = no posts exist for this type of user Note: = some posts exist for this type of user Course s* t* m* st* sm* tm* o* User e               I1 I2 I3 I4 P1 P2 P3 P4 Time has passed For each of the eight courses, change the year to 2017 (they will now be just over one year ago) # Subject Deletion Request Create deletion requests for the second user of each type using the attached test-63496-requests.php script: php test-63496-requests.php --usernamefilter='m63496-1-%2' Run cron: php admin/cli/cron.php Navigate to Site administration > Users > Privacy and Policies > Data requests Note: You may find it easier to test this one user at a time by only approving one deletion, then run the task, and confirm the behaviour for that user Approve all of the requests Run cron: php admin/cli/cron.php View the forum in each course (Not the announcement forum) and confirm that the post from those users are deleted or not deleted as per : Note: = no posts exist for this user Note: = some posts still exist for this user Course t2 m2 st2 sm2 tm2 o2 User             I1 I2 I3 I4 P1 P2 P3 P4 Check Expiry info Run the expired retention period task: php admin/tool/task/cli/schedule_task.php --execute="\tool_dataprivacy\task\expired_retention_period" Navigate to the list of data deletions Confirm that only the four 'P' courses are listed Confirm that they state: Default retention period: 1 days (Expired) Manager retention period: 5 years (Unexpired) Data for all users except for Managers will be removed Run expiry task Note: You may find it easier to test this one course at a time by only approving one deletion, then run the taks, and confirm the behaviour for that course. Approve the deletions Run the expired context deletion task: php admin/tool/task/cli/schedule_task.php --execute="\tool_dataprivacy\task\delete_expired_contexts" View the forum in each course (Not the announcement forum) and confirm that the post from those users are deleted or not deleted as per : Note: = no posts exist for this type of user Note: = some posts exist for this type of user Course t* m* st* sm* tm* o* User             P1 P2 P3 P4 Time has passed For each of the eight courses, change the year to 2008 (they will now be just over ten years ago) Subject Deletion Request Create deletion requests for the third user of each type using the attached test-63496-requests.php script: php test-63496-requests.php --usernamefilter='m63496-1-%3' Run cron: php admin/cli/cron.php Navigate to Site administration > Users > Privacy and Policies > Data requests Note: You may find it easier to test this one user at a time by only approving one deletion, then run the task, and confirm the behaviour for that user Approve all of the requests Run cron: php admin/cli/cron.php View the forum in each course Confirm that none of the '3' users have any content left Note: = no posts exist for this user Note: = some posts still exist for this user Course t3 m3 st3 sm3 tm3 o3 User             I1 I2 I3 I4 P1 P2 P3 P4 Check Expiry info Run the expired retention period task: php admin/tool/task/cli/schedule_task.php --execute="\tool_dataprivacy\task\expired_retention_period" Navigate to the list of data deletions Confirm that all eight courses are listed Confirm that courses all of the I courses state: Default retention period: 10 Years (Expired) Delete data for all users Confirm that courses P courses state: Default retention period: 1 days (Expired) Delete data for all users Run expiry task Note: You may find it easier to test this one course at a time by only approving one deletion, then run the taks, and confirm the behaviour for that course. Approve the deletions Run the expired context deletion task: php admin/tool/task/cli/schedule_task.php --execute="\tool_dataprivacy\task\delete_expired_contexts" View the forum in each course Confirm that there are no discussions View the Participants page in each course Confirm that there are no participants
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE
    • Epic Link:
    • Pull 3.5 Branch:
    • Pull Master Branch:
      MDL-62560-master
    • Sprint:
      GDPR Followup Sprint 1

      Description

      Add support for different retention strategies for different user roles.

      In some institutions the content created by staff is considered to be 'owned' by the institution and not the individual.
      In these cases, there may need to be a longer retention policy applied for staff than to students.

      This issue seeks to extend the existing privacy API in order to add new data deletion strategies for rolling deletion.

      This will be achieved by:

      • adding a new 'purpose override' such that a role can be allocated a different retention policy for any data retention purpose;
      • adding a new Provider interface to provide:
        • a function to fetch the list of users in a location in order to filter the users by role
        • a function to delete a set of users in a context
      • updating the current rolling expiry system to support this new functionality.

        Attachments

        1. test-63496-purposes.php
          7 kB
        2. test-63496-requests.php
          0.8 kB
        3. test-63496.php
          9 kB
        4. test-63496-35.php
          9 kB
        5. test-63496-course.php
          1 kB
        6. default-overlap-retention.png
          default-overlap-retention.png
          17 kB
        7. 1.PNG
          1.PNG
          140 kB
        8. 10.PNG
          10.PNG
          97 kB
        9. 11.PNG
          11.PNG
          149 kB
        10. 2.PNG
          2.PNG
          192 kB
        11. 3.PNG
          3.PNG
          191 kB
        12. 4.PNG
          4.PNG
          184 kB
        13. 12.PNG
          12.PNG
          213 kB
        14. 7.PNG
          7.PNG
          231 kB
        15. 9.PNG
          9.PNG
          246 kB
        16. 5.PNG
          5.PNG
          264 kB
        17. 6.PNG
          6.PNG
          350 kB
        18. 8.PNG
          8.PNG
          269 kB

          Issue Links

          1.
          Extend privacy API to support multi-user operations Sub-task Closed Andrew Nicols  
          2.
          Support for per-role deletion in the dataprivacy tool Sub-task Closed Andrew Nicols  
          3.
          Add support for removal of context users - multiple components Sub-task Closed Michael Hawkins  
          4.
          Add support for removal of context users - mod_lti Sub-task Closed Michael Hawkins  
          5.
          Add support for removal of context users - core_group and friends Sub-task Closed Shamim Rezaie  
          6.
          Add support for removal of context users - mod_scorm Sub-task Closed Michael Hawkins  
          7.
          Add support for removal of context users - mod_survey Sub-task Closed Michael Hawkins  
          8.
          Add support for removal of context users - mod_assignment Sub-task Closed Adrian Greeve  
          9.
          Add support for removal of context users - mod_wiki Sub-task Closed Michael Hawkins  
          10.
          Add support for removal of context users - core_enrol Sub-task Closed Mihail Geshoski  
          11.
          Add support for removal of context users - core_notes Sub-task Closed Mihail Geshoski  
          12.
          Add support for removal of context users - mod_assign Sub-task Closed Adrian Greeve

          100%

          Original Estimate - Not Specified Original Estimate - Not Specified
          Time Spent - 2 hours
          13.
          Add support for removal of context users - core_portfolio Sub-task Closed Mihail Geshoski  
          14.
          Add support for removal of context users - core_webservice Sub-task Closed Mihail Geshoski  
          15.
          Add support for removal of context users - core_user Sub-task Closed Mihail Geshoski  
          16.
          Add support for removal of context users - core_rss Sub-task Closed Mihail Geshoski  
          17.
          Add support for removal of context users - core_repository Sub-task Closed Mihail Geshoski  
          18.
          Add support for removal of context users - repository_[x] Sub-task Closed Michael Hawkins  
          19.
          Add support for removal of context users - search_[x] Sub-task Closed Michael Hawkins  
          20.
          Add support for removal of context users - cachestores Sub-task Closed Shamim Rezaie  
          21.
          Add support for removal of context users - portfolios Sub-task Closed Shamim Rezaie  
          22.
          Add support for removal of context users - core_question + mod_quiz Sub-task Closed Shamim Rezaie  
          23.
          Display core_userlist validation in data registry Sub-task Closed Adrian Greeve  
          24.
          Add support for removal of context users - profilefield_checkbox Sub-task Closed Mihail Geshoski  
          25.
          Add support for removal of context users - profilefield_datetime Sub-task Closed Mihail Geshoski  
          26.
          Add support for removal of context users - profilefield_menu Sub-task Closed Mihail Geshoski  
          27.
          Add support for removal of context users - profilefield_text Sub-task Closed Mihail Geshoski  
          28.
          Add support for removal of context users - profilefield_textarea Sub-task Closed Mihail Geshoski  
          29.
          Add support for removal of context users - auth_oauth2 Sub-task Closed Mihail Geshoski  
          30.
          Add support for removal of context users - auth_mnet Sub-task Closed Mihail Geshoski  
          31.
          Add support for removal of context users - mod_quiz Sub-task Closed Shamim Rezaie  
          32.
          Add support for removal of context users - core_backup Sub-task Closed Mihail Geshoski  
          33.
          Add support for removal of context users - core_badges Sub-task Closed Mihail Geshoski  
          34.
          Add support for removal of context users - message_airnotifier Sub-task Closed Mihail Geshoski  
          35.
          Add support for removal of context users - message_email Sub-task Closed Mihail Geshoski  
          36.
          Add support for removal of context users - message_jabber Sub-task Closed Mihail Geshoski  
          37.
          Add support for removal of context users - core_plagiarism Sub-task Closed Adrian Greeve  
          38.
          Add support for removal of context users - core_cohort Sub-task Closed Mihail Geshoski  
          39.
          Add support for removal of context users - core_grading Sub-task Closed Adrian Greeve  
          40.
          Add support for removal of context users - tool_cohortroles Sub-task Closed Mihail Geshoski  
          41.
          Add support for removal of context users - block_comments Sub-task Closed Mihail Geshoski  
          42.
          Add support for removal of context users - enrol_paypal Sub-task Closed Shamim Rezaie  
          43.
          Add support for removal of context users - block_community Sub-task Closed Mihail Geshoski  
          44.
          Add support for removal of context users - block_recent_activity Sub-task Closed Mihail Geshoski  
          45.
          Add support for removal of context users - block_rss_client Sub-task Closed Mihail Geshoski  
          46.
          Add support for removal of context users - block_tag_flickr Sub-task Closed Mihail Geshoski  
          47.
          Add support for removal of context users - core_fileconverter Sub-task Closed Mihail Geshoski  
          48.
          Add support for removal of context users - core_files Sub-task Closed Mihail Geshoski  
          49.
          Add support for removal of context users - enrol_flatfile Sub-task Closed Shamim Rezaie  
          50.
          Add support for removal of context users - enrol_lti Sub-task Closed Shamim Rezaie  
          51.
          Add support for removal of context users - tool_messageinbound Sub-task Closed Michael Hawkins  
          52.
          Add support for removal of context users - tool_mobile Sub-task Closed Michael Hawkins  
          53.
          Add support for removal of context users - tool_monitor Sub-task Closed Michael Hawkins  
          54.
          Add support for removal of context users - tool_policy Sub-task Closed Michael Hawkins  
          55.
          Add support for removal of context users - mod_choice Sub-task Closed Shamim Rezaie  
          56.
          Add support for removal of context users - tool_log Sub-task Closed Adrian Greeve  
          57.
          Add support for removal of context users - core_course and core_completion subsystem Sub-task Closed Michael Hawkins  
          58.
          Add support for removal of context users - fileconverter_googledrive Sub-task Closed Mihail Geshoski  
          59.
          Add support for removal of context users - ltiservice_gradebookservices Sub-task Closed Mihail Geshoski  
          60.
          Add support for removal of context users - ltiservice_memberships Sub-task Closed Mihail Geshoski  
          61.
          Add support for removal of context users - report_stats Sub-task Closed Mihail Geshoski  
          62.
          Add support for removal of context users - mnetservice_enrol Sub-task Closed Mihail Geshoski  
          63.
          Add support for removal of context users - core_calendar Sub-task Closed Mihail Geshoski  
          64.
          Add support for removal of context users - core_tag Sub-task Closed Mihail Geshoski  
          65.
          Add support for removal of context users - mod_workshop Sub-task Closed David Mudrák (@mudrd8mz)  
          66.
          Add support for removal of context users - core_blog Sub-task Closed Adrian Greeve  
          67.
          Add support for removal of context users - core_analytics Sub-task Closed Michael Hawkins  
          68.
          Add support for removal of context users - editor_atto Sub-task Closed Mihail Geshoski  
          69.
          Add support for removal of context users - core_block Sub-task Closed Adrian Greeve  
          70.
          Add support for removal of context users - core_role Sub-task Closed Mihail Geshoski  
          71.
          Add support for removal of context users - core_grades Sub-task Closed Adrian Greeve  
          72.
          Add support for removal of context users - core_message Sub-task Closed Shamim Rezaie  
          73.
          Add support for removal of context users - core Sub-task Closed Shamim Rezaie  
          74.
          Add support for removal of context users - core_competency Sub-task Closed Michael Hawkins  
          75.
          Some get_users_in_context docblocks are incorrect Sub-task Closed Michael Hawkins  
          76.
          Add support for removal of context users - block_recentlyaccessed_items block Sub-task Closed Víctor Déniz Falcón  

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/Nov/18

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 2 hours, 30 minutes
                  1d 2h 30m