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

Calendar export_execute.php creates global USER with limited fields

XMLWordPrintable

    • MOODLE_402_STABLE, MOODLE_403_STABLE
    • MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-80793-402
    • MDL-80793-403
    • Hide
      1. Log in to Moodle as an administrator
      2. Navigate to Site Administration > Users
      3. Create a new user with email address test@example.com
      4. Navigate to Site Administration > Courses
      5. Create a new course
      6. Navigate to the new course
      7. Turn on edit mode
      8. Add an assignment activity to the course with the following settings
        1. Availability > Due date > Enabled one week in the future
        2. Restrict access > User profile > Email = test@example.com
      9. From the course landing page navigate to Participants
      10. Enrol your test user as a student
      11. Click the link to the newly enrolled user
      12. Click Log in as
      13. From the profile menu, click Calendar
      14. Verify assignment due date is visible on the calendar
      15. Click Import or export calendars
      16. Click Export calendar
      17. Select All events and This month
      18. Click Get calendar URL
      19. Paste the URL into your browser window - expect an .ics file to be downloaded
      20. Open the .ics file with a text editor
      21. Verify the .ics file contains the event for the assignment due date
      Show
      Log in to Moodle as an administrator Navigate to Site Administration > Users Create a new user with email address test@example.com Navigate to Site Administration > Courses Create a new course Navigate to the new course Turn on edit mode Add an assignment activity to the course with the following settings Availability > Due date > Enabled one week in the future Restrict access > User profile > Email = test@example.com From the course landing page navigate to Participants Enrol your test user as a student Click the link to the newly enrolled user Click Log in as From the profile menu, click Calendar Verify assignment due date is visible on the calendar Click Import or export calendars Click Export calendar Select All events and This month Click Get calendar URL Paste the URL into your browser window - expect an .ics file to be downloaded Open the .ics file with a text editor Verify the .ics file contains the event for the assignment due date

      It seems like export_execute.php should be setting up the global USER with all of the standard fields a user might have. This traceback is caused by the availability component trying to access the user's 'email' property. We can't know what any given component might do, but it is reasonable for them to expect a fully initialised global USER.

      PHP Notice:  Error processing availability data for 'example': Requested user profile field does not exist
      line 303 of /availability/classes/info.php: call to debugging()
      line 199 of /availability/classes/info.php: call to core_availability\info->warn_about_invalid_availability()
      line 2352 of /lib/modinfolib.php: call to core_availability\info->is_available()
      line 2386 of /lib/modinfolib.php: call to cm_info->obtain_dynamic_data()
      line 1592 of /lib/modinfolib.php: call to cm_info->get_user_visible()
      line 102 of /filter/activitynames/filter.php: call to cm_info->__get()
      line 78 of /filter/activitynames/filter.php: call to filter_activitynames->get_activity_list()
      line 42 of /filter/activitynames/filter.php: call to filter_activitynames->get_cached_activity_list()
      line 515 of /lib/filterlib.php: call to filter_activitynames->filter()
      line 188 of /lib/filterlib.php: call to moodle_text_filter->filter_stage_post_clean()
      line 230 of /lib/filterlib.php: call to filter_manager->apply_filter_chain()
      line 1370 of /lib/weblib.php: call to filter_manager->filter_text()
      line 246 of /calendar/export_execute.php: call to format_text() in /path/to/moodle/lib/weblib.php on line 3406 

      Steps to reproduce:

      1. On a fresh course
      2. Add an assignment activity with a due date and a restriction that checks the user profile email field is equal to test@example.com
      3. Enrol a non-privileged test user with email address test@example.com and log-in-as
      4. Note the student is able to see the activity due date in the calendar - expected
      5. Export the test user's calendar using a link - make sure the filter will include the assignment due date
      6. Paste the link into a private window (expect .ics file to be downloaded)
      7. Note the traceback above in the php error log
      8. Note that the resulting .ics file does not include the assignment due date - we would have expected to see that

            hsmithnz Harry Smith
            hsmithnz Harry Smith
            Paul Holden Paul Holden
            Ilya Tregubov Ilya Tregubov
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 11 minutes
                1h 11m

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