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

Glossary module can leave orphan records behind

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.5, 3.4.2, 3.5, 3.6
    • Fix Version/s: 3.4.4, 3.5.1
    • Component/s: Glossary, Privacy
    • Labels:
    • Testing Instructions:
      Hide

      Please refer to this document to get the testing scripts
      https://docs.moodle.org/dev/Privacy_API/Utilities

      1. Log in as admin.
      2. In a given course, enrol some students (s1, s2)
      3. Create a glossary and enable the following settings:
        • Under Entries, set Allow comments on entries to Yes
        • Under Ratings, set Aggregate type to Average of ratings (can be any type)
      4. Save and display.
      5. Log in as s1 and go to the glossary
      6. Add a new entry giving a concept easy to identify such: s1 entry
        • Add an attachment and a tag such "s1entrytag"
      7. Save changes
      8. Log in as s2 and repeat the last 3 steps.
      9. Log in as admin and go to that glossary.
      10. Create an entry.
      11. Add a rating to s1 and s2 entries.
      12. Add few comments on the entries.
      13. Now, using our privacy export testing script, update it to use s1 user id.
      14. Export user data and make sure it exports correctly your entries, tags, comments and ratings.
      15. Update the privacy export testing script, update it to use s2 user id.
      16. Export user data and make sure it exports correctly your entries, tags, comments and ratings.
      17. Now, using our privacy deletion testing script, update it to use s1 user id.
      18. Run the script, make sure s1 data (tags, comments, entries) have been deleted.
        • User 2 and admin data should not be deleted.
      19. Now, using our privacy deletion testing script (delete all users data one).
      20. Run the script, all user data (admin, s2) should also be deleted.
      Show
      Please refer to this document to get the testing scripts https://docs.moodle.org/dev/Privacy_API/Utilities Log in as admin. In a given course, enrol some students (s1, s2) Create a glossary and enable the following settings: Under Entries , set Allow comments on entries to Yes Under Ratings , set Aggregate type to Average of ratings (can be any type) Save and display. Log in as s1 and go to the glossary Add a new entry giving a concept easy to identify such: s1 entry Add an attachment and a tag such "s1entrytag" Save changes Log in as s2 and repeat the last 3 steps. Log in as admin and go to that glossary. Create an entry. Add a rating to s1 and s2 entries. Add few comments on the entries. Now, using our privacy export testing script, update it to use s1 user id. Export user data and make sure it exports correctly your entries, tags, comments and ratings. Update the privacy export testing script, update it to use s2 user id. Export user data and make sure it exports correctly your entries, tags, comments and ratings. Now, using our privacy deletion testing script, update it to use s1 user id. Run the script, make sure s1 data (tags, comments, entries) have been deleted. User 2 and admin data should not be deleted. Now, using our privacy deletion testing script (delete all users data one). Run the script, all user data (admin, s2) should also be deleted.
    • Affected Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE
    • Epic Link:
    • Pull from Repository:
    • Pull Master Branch:
      MDL-62446-master
    • Sprint:
      GDPR Followup Sprint 1

      Description

      When deleting the data for all users in the privacy provider, the categories and aliases for the entries won't be deleted. The foreach will loop over an empty list, thus leaving the records behind.

      // Simplified code from line 250 onwards.
      $DB->delete_records('glossary_entries', ['glossaryid' => $instanceid]);
      ...
      $entries = $DB->get_records('glossary_entries', ['glossaryid' => $instanceid]);
      foreach ($entries as $entry) {
          $DB->delete_records('glossary_entries_categories', ['entryid' => $entry->id]);
          $DB->delete_records('glossary_alias', ['entryid' => $entry->id]);
      }
      

      It seems that the tests do not check the deletion of those related records.

      Also to consider: using get_in_or_equal instead of foreach.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Jul/18