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

Events without subscriptions can lock users out of their sites

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Testing scenario 1: upgrade step to remove orphaned subscription events

      Please test this before upgrade

      1. Login as s2
      2. Add the Upcoming events block to your dashboard.
      3. Go to Calendar > Manage subscriptions
      4. Import the events using the attached ICS file.
      5. Note the events have been imported
      6. Log out.
      7. Go to your database and search for the subscription for s2 user:

        SELECT * FROM mdl_event_subscriptions WHERE userid = S2_USERID;

      8. Make note of the subscription id and delete that subscription: 

        DELETE FROM mdl_event_subscriptions WHERE userid = S2_USERID;

      9. Note there are some "orphaned* subscription events in the event table:

        SELECT * FROM mdl_event WHERE subscriptionid = SUBSCRIPTION_ID;

      10. Purge caches.
      11. In the browser, try to log in again as s2.
      12. Note you get a nasty error of missing records and you are locked outside the side.
      13. Now, upgrade your moodle instance
        • If you don't use mdk upgrade, you might need to log in as admin in an incognito window to upgrade through the browser.
      14. Reload the window of s2 user.
      15. Make sure the error is gone and you are able to log in to your moodle instance.
      16. Check in the event table for that subscription events.

        SELECT * FROM mdl_event WHERE subscriptionid = SUBSCRIPTION_ID;

      17. Make sure all events related to the subscription have been deleted.

      Testing scenario 2: user subscription events deletion

      1. Login as s3
      2. Go to Calendar > Manage subscriptions
      3. Import the events using the attached ICS file.
      4. Note the events have been imported
      5. Log in as admin and go to Site administration > Users > Accounts > Browse list of users.
      6. Find s3 user hover over the name link and make note of the id
      7. Open the database and get the event_subscriptions for the s3 user:

        SELECT * FROM mdl_event_subscriptions WHERE userid = S3_USERID;

      8. Make note of the id in the mdl_event_subscriptions table for that user
      9. Check in the event for the user:

        SELECT * FROM mdl_event WHERE subscriptionid = SUBSCRIPTION_ID;

      10. Now on the Moodle UI delete s3 user.
      11. Run those queries (#7 and #9)  again and make sure there are no records for that user and subscription in both tables.
      Show
      Testing scenario 1: upgrade step to remove orphaned subscription events Please test this before upgrade Login as s2 Add the Upcoming events block to your dashboard. Go to Calendar > Manage subscriptions Import the events using the attached ICS file. Note the events have been imported Log out. Go to your database and search for the subscription for s2 user: SELECT * FROM mdl_event_subscriptions WHERE userid = S2_USERID; Make note of the subscription id and delete that subscription:  DELETE FROM mdl_event_subscriptions WHERE userid = S2_USERID; Note there are some "orphaned* subscription events in the event table: SELECT * FROM mdl_event WHERE subscriptionid = SUBSCRIPTION_ID; Purge caches. In the browser, try to log in again as s2 . Note you get a nasty error of missing records and you are locked outside the side. Now, upgrade your moodle instance If you don't use mdk upgrade, you might need to log in as admin in an incognito window to upgrade through the browser. Reload the window of s2 user. Make sure the error is gone and you are able to log in to your moodle instance. Check in the event table for that subscription events. SELECT * FROM mdl_event WHERE subscriptionid = SUBSCRIPTION_ID; Make sure all events related to the subscription have been deleted. Testing scenario 2: user subscription events deletion Login as s3 Go to Calendar > Manage subscriptions Import the events using the attached ICS file. Note the events have been imported Log in as admin and go to Site administration > Users > Accounts > Browse list of users. Find s3 user hover over the name link and make note of the id Open the database and get the event_subscriptions for the s3 user: SELECT * FROM mdl_event_subscriptions WHERE userid = S3_USERID; Make note of the id in the mdl_event_subscriptions table for that user Check in the event for the user: SELECT * FROM mdl_event WHERE subscriptionid = SUBSCRIPTION_ID; Now on the Moodle UI delete s3 user. Run those queries (#7 and #9)  again and make sure there are no records for that user and subscription in both tables.
    • Affected Branches:
      MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE
    • Pull from Repository:
    • Pull 3.8 Branch:
    • Pull Master Branch:
      MDL-67312-master
    • Sprint:
      Internationals - 3.8 Alpha, Internationals - 3.9 Sprint 1, International 3.9 - Sprint 3, International 3.9 - Sprint 4

      Description

      In MDL-66551 orphaned calendar subscriptions are cleaned up, but the events can be left behind. In some of our production sites we have seen users locked out of their site because the calendar expects the subscription relating to an event to exist.

      In other parts of moodle we do clean up the events related to a subscription upon deletion of said subscription. E.g., https://github.com/moodle/moodle/blob/master/calendar/lib.php#L2960

      So it seems reasonable that we should delete the subscription as part of the process implemented in MDL-66551

        Attachments

        1. holidays.ics
          28 kB
        2. Screenshot_1.png
          Screenshot_1.png
          271 kB
        3. Screenshot_2.png
          Screenshot_2.png
          195 kB

          Issue Links

            Activity

              People

              Assignee:
              lameze Simey Lameze
              Reporter:
              cameron1729 cameron1729
              Peer reviewer:
              Jun Pataleta
              Integrator:
              Sara Arjona (@sarjona)
              Tester:
              Janelle Barcega
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Mar/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 week, 3 hours, 12 minutes
                  1w 3h 12m