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

LDAP enrollment: users unenrolled on login when courses are unavailable to students (with patch)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.4, 1.9
    • Fix Version/s: 1.8.5, 1.9.1
    • Component/s: Enrolments
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      From http://moodle.org/mod/forum/discuss.php?d=93109

      "Any time a user is enrolled in a course via LDAP, they are unenrolled when they log in if the course is set to be unavailable to students (invisible). [...] Running enrol_ldap_sync.php properly restores enrollments to all courses. It's only when users actually log in (or when an admin uses login as) that the users are unenrolled, at which point only running enrol_ldap_sync.php will restore the enrollments."

      This is because of this piece of code in setup_enrolments():

      } else { // the course object exists before we call...
      if ($course_obj->visible==0)

      { // non-visible courses don't show up in the enrolled // array, so we should skip them -- continue; }

      }

      This is a leftover from the pre-roles era, when we didn't have moodle/course:viewhiddencourses. But now we don't need this at all, and in fact it's buggy, as everybody is unenrolled from the course. If we keep the enrolment, the role & capability checks will hide the course to those not having the right cap, while allowing the rest to enter the course.

      The attached patch fixes the issue for 1.8, 1.9 and HEAD.

      Saludos. Iñaki.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stronk7 Eloy Lafuente (stronk7)
                Reporter:
                iarenaza Iñaki Arenaza
                Tester:
                Martin Dougiamas
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  8/Apr/08