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

Hiding an activity with calendar events breaks moodle for all non-admin users

    XMLWordPrintable

Details

    • MOODLE_27_STABLE, MOODLE_28_STABLE
    • MOODLE_27_STABLE
    • Hide
      • Create a test course with a student enrolled and a mod_assign in it.
      • As an admin, set the mod_assign activity as hidden site-wide.
      • Login as the student
        Expect: to see the moodle homepage
        Actual: you see a coding exception and can't do anything.
      Show
      Create a test course with a student enrolled and a mod_assign in it. As an admin, set the mod_assign activity as hidden site-wide. Login as the student Expect: to see the moodle homepage Actual: you see a coding exception and can't do anything.

    Description

      The availability function info_module->is_user_visible() checks the uservisible flag on cm's via the get_fast_modinfo() call.

      However, if the cm in question is not in the list returned by get_cms(), then a coding exception is thrown and the user is presented with an entirely unusable interface.

      This is quickly and easily tested by adding a mod_assign activity to a course and having a student enrolled in that course. Set the mod_assign activity as hidden under site admin and then login as the student. You'll immediately see the issue.

      The reason this happens is the calendar has an event for the now hidden activity, and for each event, it calls the is_user_visible() function to see if it should be displaying it.

      Attachments

        Activity

          People

            aolley Adam Olley
            aolley Adam Olley
            Sam Marshall Sam Marshall
            Damyon Wiese Damyon Wiese
            Simey Lameze Simey Lameze
            Sam Marshall, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10/Nov/14