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

Switching to a different role doesn't let you view a course you're not enrolled in

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.1.3
    • 2.1.4, 2.2.1
    • Enrolments
    • Any
    • MOODLE_21_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • w51_MDL-30588_m23_switchrole
    • Hide

      Enrol in the course before switching role

      Show
      Enrol in the course before switching role
    • Hide

      0. disable all guest access to course
      1. assign manager role to user in course, do not enroll them
      2. login as that user
      3. switch role to user
      4. no enrol prompt expected any more

      Show
      0. disable all guest access to course 1. assign manager role to user in course, do not enroll them 2. login as that user 3. switch role to user 4. no enrol prompt expected any more

    Description

      If you try to switch role whilst not enrolled in a course, an error is displayed informing you that you're not enrolled on the course.

      It appears that require_login() is missing a case checking for

      is_role_switch($course->id)

      when checking $access at around line 2584 of lib/modlelib.php

      Attachments

        Activity

          People

            skodak Petr Skoda
            dobedobedoh Andrew Lyons
            Sam Hemelryk Sam Hemelryk
            Rossiani Wijaya Rossiani Wijaya
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9/Jan/12