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

    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      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

            Assignee:
            aolley Adam Olley
            Reporter:
            aolley Adam Olley
            Peer reviewer:
            Sam Marshall
            Integrator:
            Damyon Wiese
            Tester:
            Simey Lameze
            Participants:
            Component watchers:
            Sam Marshall, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              10/Nov/14