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

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

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7.6, 2.8.4
    • 3.0
    • Conditional activities
    • MOODLE_27_STABLE, MOODLE_28_STABLE
    • MOODLE_30_STABLE
    • MDL-49434-master
    • 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.

    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

              quen Sam Marshall
              marina Marina Glancy
              Marina Glancy Marina Glancy
              Andrew Lyons Andrew Lyons
              Rajesh Taneja Rajesh Taneja
              Amaia Anabitarte, Bas Brands, Carlos Escobedo, Laurent David, Sabina Abellan, Sara Arjona (@sarjona)
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                16/Nov/15