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

Improve performance of get_contexts_for_userid

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.6, 3.4.3, 3.5.1, 3.6
    • Fix Version/s: 3.3.8, 3.4.5, 3.5.2
    • Component/s: Privacy
    • Labels:
    • Testing Instructions:
      Hide

       General comments

      Perform a standard full data export SAR cycle.

      Pre-requisites

      Data Protection Officer (DPO) role creation

      1. Login as an admin
      2. Go to "Site administration / Users / Define roles"
      3. Create a Data Protection Officer role with the following settings:
        Short name dpo
        Custom full name Data Protection Officer
        Role archetype Guest
        Context types where this role may be assigned System
        Capability "moodle/site:configview" (Allow)
        Capability "tool/dataprivacy:managedatarequests" (Allow)
        Capability "tool/dataprivacy:managedataregistry" (Allow)
        Capability "moodle/category:viewhiddencategories" (Allow)
        Capability "moodle/course:viewhiddencourses" (Allow)
        Capability "moodle/course:view" (Allow)
        Capability "moodle/course:viewhiddenactivities" (Allow)
        Capability "tool/dataprivacy:makedatarequestsforchildren" (Allow)

      Notice: if you want you can create this role from dpo.xml file attached. To do that, go to http://MOODLESITE/admin/roles/define.php?action=add drag dpo.xml into file area in "Use role preset" and press Continue button. 

      1. Save changes.
        • Confirm that the role is successfully created.
      2. Go to "Site administration / Users / Permissions / Assign system roles"
      3. Assign at least one user to the DPO role.
      4. Save the changes.

      New course and new user

      1. Create a new course in the Miscellaneous category with some activities and resources.
        1. If you want you can restore the backup file attached (backup-moodle2-course-2-activity_examples-20180724-2227.mbz). This backup course contains a great variety of activities and resources. Also, it contains users.
        2. To do that, got to http://MOODLESITE/backup/restorefile.php?contextid=1.
        3. Drag the backup file into file area and press Restore button.
        4. Follow the steps. (Important, select Miscellaneous category to restore the backup).
      2. Create a new user and enrol in this new course.
        • If you have restored the backup then you already have new users and enrolled in the course.
      Allow users to request data
      1. Log in as admin and enabled 'Contact the privacy officer' and 'Privacy officer role mapping' in Site administration -> Users -> Privacy and policies -> Privacy settings

      Test

      Data request: Export
      1. Log in as a new user or existing user enrolled in the new course (student3 for instance).
      2. Do some activities (forum, quiz, assign, chat, choice, database, glossary, wiki, workshop ...).
      3. Create a new event on the Calendar.
      4. Go to your profile page.
      5. Click on "Blog entries"
      6. Add a new entry (try to add a new entry with pictures).
      7. Send a new message to another user.
      8. Logout.
      9. Log in as an admin.
      10. Go to the new course and grade some activities of the previous user.
      11. Logout.
      12. Log in a previous user (the student user).
      13. Go to profile page.
      14. Click on "Data requests"
      15. Click on "New request"
      16. Select "Export all of my personal data" for the Type field.
      17. Enter a message "Export request".
      18. Click "Save changes".
      19. Logout and Log in as a DPO user.
      20. Go to Data request page http://MOODLESITE/admin/tool/dataprivacy/datarequests.php.
      21. Open a terminal.
      22. Go to the root directory of your moodle instance.
      23. Execute CRON 

        php admin/cli/cron.php

        • Confirm that the CRON script completes successfully and that you don't encounter any errors.
      24. Log in as a  DPO user and go to Data request page http://MOODLESITE/admin/tool/dataprivacy/datarequests.php.
        • Confirm that you can see the status "Awaiting approval" on the request user.
      1. Click on the "Actions" menu and Approve request.
      2. Back to your terminal, run CRON again.
        • Confirm that the CRON runs successfully.
      3. Log in as a DPO user again and check that you can see the status "Complete" on the request user.
      4. Log in as a student user.
      5. Go to the new Notification and click on Download link to get the Export file.
      6. Go to the Download folder in your computer and unzip de Export ZIP file.
      7. Expected result: Browse through the new folder and verify that the correct structure has been created and contains the required data.
      8. Expected result:  Check into the User folder that exists a Blog folder with the entry of the blog with all the data.
      Show
       General comments Perform a standard full data export SAR cycle. Pre-requisites Data Protection Officer (DPO) role creation Login as an admin Go to " Site administration / Users / Define roles " Create a Data Protection Officer role with the following settings: Short name dpo Custom full name Data Protection Officer Role archetype Guest Context types where this role may be assigned System Capability "moodle/site:configview" (Allow) Capability "tool/dataprivacy:managedatarequests" (Allow) Capability "tool/dataprivacy:managedataregistry" (Allow) Capability "moodle/category:viewhiddencategories" (Allow) Capability "moodle/course:viewhiddencourses" (Allow) Capability "moodle/course:view" (Allow) Capability "moodle/course:viewhiddenactivities" (Allow) Capability "tool/dataprivacy:makedatarequestsforchildren" (Allow) Notice : if you want you can create this role from dpo.xml file attached. To do that, go to http://MOODLESITE/admin/roles/define.php?action=add  drag dpo.xml into file area in "Use role preset" and press Continue button.  Save changes. Confirm  that the role is successfully created. Go to " Site administration / Users / Permissions / Assign system roles " Assign at least one user to the DPO role. Save the changes. New course and new user Create a new course in the Miscellaneous category with some activities and resources. If you want you can restore the backup file attached (backup-moodle2-course-2-activity_examples-20180724-2227.mbz). This backup course contains a great variety of activities and resources. Also, it contains users. To do that, got to http://MOODLESITE/backup/restorefile.php?contextid=1. Drag the backup file into file area and press Restore button. Follow the steps. (Important, select Miscellaneous category to restore the backup). Create a new user and enrol in this new course. If you have restored the backup then you already have new users and enrolled in the course. Allow users to request data Log in as admin and enabled 'Contact the privacy officer' and 'Privacy officer role mapping' in Site administration -> Users -> Privacy and policies -> Privacy settings Test Data request: Export Log in as a new user or existing user enrolled in the new course (student3 for instance). Do some activities (forum, quiz, assign, chat, choice, database, glossary, wiki, workshop ...). Create a new event on the Calendar. Go to your profile page. Click on "Blog entries" Add a new entry (try to add a new entry with pictures). Send a new message to another user. Logout. Log in as an admin. Go to the new course and grade some activities of the previous user. Logout. Log in a previous user (the student user). Go to profile page. Click on " Data requests " Click on " New request " Select " Export all of my personal data " for the Type field. Enter a message "Export request". Click " Save changes ". Logout and Log in as a DPO user. Go to Data request page http://MOODLESITE/admin/tool/dataprivacy/datarequests.php. Open a terminal. Go to the root directory of your moodle instance. Execute CRON  php admin/cli/cron.php Confirm  that the CRON script completes successfully and that you don't encounter any errors. Log in as a  DPO user and go to Data request page  http://MOODLESITE/admin/tool/dataprivacy/datarequests.php. Confirm that you can see the status "Awaiting approval" on the request user. Click on the " Actions " menu and Approve request. Back to your terminal, run CRON again. Confirm  that the CRON runs successfully. Log in as a DPO user again and check that you can see the status "Complete" on the request user. Log in as a student user. Go to the new Notification and click on Download link to get the Export file. Go to the Download folder in your computer and unzip de Export ZIP file. Expected result: Browse through the new folder and verify that the correct structure has been created and contains the required data. Expected result :  Check into the User folder that exists a Blog folder with the entry of the blog with all the data.
    • Affected Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • Pull from Repository:
    • Pull 3.5 Branch:
      MDL-62619-35-privacycontexts
    • Pull Master Branch:
      MDL-62619-master-privacycontexts

      Description

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Sep/18