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

Availability code uses the renderer as part of $cm->uservisible check

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7.6, 2.8.4
    • Fix Version/s: 3.0
    • Component/s: Conditional activities
    • Labels:
    • Testing Instructions:
      Hide

      Automated tests are available; I added an extra test to cover the issue. To test various aspects of this, run Behat --tags=core_availability,availability (takes < 15 minutes on my system). This includes basically the manual test below:

      0. Ensure availability and completion are enabled at system level, and completion is enabled on a test course.
      1. Create a couple of activities (e.g. Page) that are set to be marked complete by the student with manual tickboxes.
      2. Create a Glossary with default settings. Under 'Restrict access', set it to be unavailable unless both of the previous activities are marked complete.
      3. Log in as an editing teacher (not admin) and view the glossary.

      EXPECTED: The glossary appears.
      BEFORE FIX: An exception was thrown at this point.

      Show
      Automated tests are available; I added an extra test to cover the issue. To test various aspects of this, run Behat --tags=core_availability,availability (takes < 15 minutes on my system). This includes basically the manual test below: 0. Ensure availability and completion are enabled at system level, and completion is enabled on a test course. 1. Create a couple of activities (e.g. Page) that are set to be marked complete by the student with manual tickboxes. 2. Create a Glossary with default settings. Under 'Restrict access', set it to be unavailable unless both of the previous activities are marked complete. 3. Log in as an editing teacher (not admin) and view the glossary. EXPECTED: The glossary appears. BEFORE FIX: An exception was thrown at this point.
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Epic Link:
    • Pull Master Branch:
      MDL-49434-master

      Description

      line 507 of /availability/classes/tree.php: call to moodle_page->get_renderer()
      

      The check $cm->uservisible may be executed before the course/cm/page/context are set, which throws debugging in the above line of code. Also when we try to set the current course later, the fatal exception occurs.

      It was urgently fixed in MDL-49418, this fix should be rolled back and instead availability code to be fixed.

      Error occurs when one module has two or more access restrictions

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  16/Nov/15