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

Add error handling for exports and deletes

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.3.6, 3.4.3
    • 3.3.5, 3.4.2, 3.5
    • Privacy
    • MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_33_STABLE, MOODLE_34_STABLE
    • MDL-62134-master
    • Hide

      Setup

      All
      1. Ensure you have mailcatcher setup
      2. Configure the Data Protection Officer role and add a user to this role
      3. Open blocks/html/classes/privacy/provider.php in your preferred editor
        1. Find get_contexts_for_userid
        2. Add a call to throw new \moodle_exception();
      4. Open message/classes/privacy/provider.php in your preferred editor
        1. Find export_user_data
        2. Add a call to throw new \moodle_exception();
        3. Find delete_data_for_user
        4. Add a call to throw new \moodle_exception();
      33
      1. Checkout https://github.com/andrewnicols/moodle-tool_dataprivacy/tree/MDL-62134-33 to admin/tool/dataprivacy
      34
      1. Checkout https://github.com/andrewnicols/moodle-tool_dataprivacy/tree/MDL-62134-34 to admin/tool/dataprivacy

      Test

      1. Your site needs to have working email (or use mailcatcher)
      2. Request data export as any user (they need to have any data in at least three different components/plugins)
      3. Run attached runadhoc.php
      4. Make sure the exception message and backtrace are printed in cron output
      5. Check email of DPO (or admin if there is no DPO)
      6. Make sure you received an email about the exception
      7. Approve request and run cron
      8. Again, check that message appeared in cron, email was sent
      9. Make sure that actual export was done and has all other plugins data
      10. Repeat the process for a delete request
      Show
      Setup All Ensure you have mailcatcher setup Configure the Data Protection Officer role and add a user to this role Open blocks/html/classes/privacy/provider.php in your preferred editor Find get_contexts_for_userid Add a call to throw new \moodle_exception(); Open message/classes/privacy/provider.php in your preferred editor Find export_user_data Add a call to throw new \moodle_exception(); Find delete_data_for_user Add a call to throw new \moodle_exception(); 33 Checkout https://github.com/andrewnicols/moodle-tool_dataprivacy/tree/MDL-62134-33 to admin/tool/dataprivacy 34 Checkout https://github.com/andrewnicols/moodle-tool_dataprivacy/tree/MDL-62134-34 to admin/tool/dataprivacy Test Your site needs to have working email (or use mailcatcher) Request data export as any user (they need to have any data in at least three different components/plugins) Run attached runadhoc.php Make sure the exception message and backtrace are printed in cron output Check email of DPO (or admin if there is no DPO) Make sure you received an email about the exception Approve request and run cron Again, check that message appeared in cron, email was sent Make sure that actual export was done and has all other plugins data Repeat the process for a delete request

      At the moment if any plugin's privacy API implementation causes an exception, the whole request fails.

      Arguably this is correct - we want to make sure the request completed correctly wherever possible, however it may be worth adding some try/catch checks around some requests to allow requests to come to some level of completion and instead alert an administrator somehow.

      Also consider rolling back database transactions.

            marina Marina Glancy
            dobedobedoh Andrew Lyons
            Frédéric Massart Frédéric Massart
            Jake Dallimore Jake Dallimore
            Ryan Wyllie Ryan Wyllie
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.