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

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.4, 1.9
    • 1.8.5, 1.9.1
    • Enrolments
    • None
    • MOODLE_18_STABLE, MOODLE_19_STABLE
    • 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

              stronk7 Eloy Lafuente (stronk7)
              iarenaza Iñaki Arenaza
              Martin Dougiamas Martin Dougiamas
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                8/Apr/08