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

enrol/database/enrol_database_sync.php unenrolls everyone!

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.7.4, 1.8.5, 1.9
    • Fix Version/s: 1.8.6, 1.9.1
    • Component/s: Enrolments
    • Labels:
      None
    • Database:
      Any
    • Affected Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      After successfully assigning users in enrol/database/enrol.php's sync_enrolments(), the script procedes to role_unassign() all users managed by the database enrollment plugin. The SQL in the section following the comment "// prune enrolments to courses that are no longer in ext auth", uses a left outer join of role_assignments on a join of context on course. The outer join returns a resultset of all database role assignments, and passes these off for unassignment.

      Line 351 of enrol/database/enrol.php (version 1.32) should read:
      351 JOIN ({$CFG->prefix}context cn
      not the current
      351 LEFT OUTER JOIN ({$CFG->prefix}context cn

      The above change will affect the stated purpose to "prune enrolments to courses that are no longer in ext auth".

      I'm guessing that the intention of the outer join was probably to find roles associated with a missing course or context. If this is necessary, some other implementation will be needed.

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/May/08