Moodle

Contextless login does not trigger auto enrollment

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 1.7
  • Fix Version/s: None
  • Component/s: Enrolments
  • Labels:
    None
  • Environment:
    Probably not applicable but here it is anyway: Mac OS X 10.4.8; Intel Xserve Core2 3 GHz Xeon, 4 GB RAM; MySQL 5.0.24a; PHP 5.2.0
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_17_STABLE

Description

If student logs in using either the Login block or the login page they can authenticate but the auto-enrollment trigger is not executed. The My Courses block does not display their courses. (Course assignments are defined in a MySQL external database and authentication is done through LDAP.)

Workaround is for the student to first to click on the course's link, and then authenticate, after which point they get the "You are about to enrol... Are you sure..." message.

Activity

Hide
Jose Hales-Garcia added a comment -

After further investigation, I need to make a correction and add more information.

First, the information. I wasn't explicit in saying that I'm using the MySQL external database plug-in. So maybe some of the environment information given may be pertinent.

As far as I can tell the bug appears to be occurring in the ADOdb library. In the file enrol/database/enrol.php, I found around line 65 (see snippet) that the $rs struct doesn't contain the proper data. The values of its results array are NULL. I haven't had time to bone up on ADOdb and delve further into it than this. If someone else doesn't do it before I get free, I'll eventually look into it.

if ($rs = $enroldb->Execute("SELECT {$CFG->enrol_remotecoursefield}
FROM {$CFG->enrol_dbtable}
WHERE {$CFG->enrol_remoteuserfield} = " . $useridfield .
(isset($remote_role_name, $remote_role_value) ? ' AND '.$remote_role_name.' = '.$remote_role_value : ''))) {

As for the correction. The student's ability to enroll themselves was due to not having an enrolment key set on the course (duh). So, when the enrolment key is set, the student is required to enter the key, even though they are in the enrollment table. This negates the advantage of using external enrollment tables at this time.

Show
Jose Hales-Garcia added a comment - After further investigation, I need to make a correction and add more information. First, the information. I wasn't explicit in saying that I'm using the MySQL external database plug-in. So maybe some of the environment information given may be pertinent. As far as I can tell the bug appears to be occurring in the ADOdb library. In the file enrol/database/enrol.php, I found around line 65 (see snippet) that the $rs struct doesn't contain the proper data. The values of its results array are NULL. I haven't had time to bone up on ADOdb and delve further into it than this. If someone else doesn't do it before I get free, I'll eventually look into it. if ($rs = $enroldb->Execute("SELECT {$CFG->enrol_remotecoursefield} FROM {$CFG->enrol_dbtable} WHERE {$CFG->enrol_remoteuserfield} = " . $useridfield . (isset($remote_role_name, $remote_role_value) ? ' AND '.$remote_role_name.' = '.$remote_role_value : ''))) { As for the correction. The student's ability to enroll themselves was due to not having an enrolment key set on the course (duh). So, when the enrolment key is set, the student is required to enter the key, even though they are in the enrollment table. This negates the advantage of using external enrollment tables at this time.
Hide
Paul Ortman added a comment -

I fought a similar bug MDL-7655 and was mucking around in the code you highlighted in comment #1. Perhaps that is biting you as well?

Show
Paul Ortman added a comment - I fought a similar bug MDL-7655 and was mucking around in the code you highlighted in comment #1. Perhaps that is biting you as well?
Hide
Jose Hales-Garcia added a comment -

Thank you Paul. This indeed was the issue.

I applied only the part of the patch relating to enrol.php (I'm not doing database authentication).

Show
Jose Hales-Garcia added a comment - Thank you Paul. This indeed was the issue. I applied only the part of the patch relating to enrol.php (I'm not doing database authentication).
Hide
Petr Škoda (skodak) added a comment -

Closing as duplicate, thanks for the info.

Show
Petr Škoda (skodak) added a comment - Closing as duplicate, thanks for the info.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: