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

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.3
    • Fix Version/s: 2.1.4, 2.2.1
    • Component/s: Enrolments
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      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
    • Workaround:
      Hide

      Enrol in the course before switching role

      Show
      Enrol in the course before switching role
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w51_MDL-30588_m23_switchrole

      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

            Assignee:
            skodak Petr Skoda
            Reporter:
            dobedobedoh Andrew Nicols
            Integrator:
            Sam Hemelryk
            Tester:
            Rossiani Wijaya
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              9/Jan/12