|
|
|
Environment:
|
OS X server
|
|
Issue Links:
|
Dependency
|
|
|
|
This issue will be resolved by:
|
|
MDL-13952
"enrol_ldap_autocreate" create courses, even if "enrol_ldap_autocreate" is set to "no"
|
|
|
|
|
Duplicate
|
|
This issue duplicates:
|
|
MDL-13952
"enrol_ldap_autocreate" create courses, even if "enrol_ldap_autocreate" is set to "no"
|
|
|
|
|
|
|
|
| Participants: |
Iñaki Arenaza and NateBaxley
|
| Security Level: |
None
|
| Difficulty: |
Easy
|
| Resolved date: |
05/Nov/09
|
| Affected Branches: |
MOODLE_19_STABLE
|
| Fixed Branches: |
MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
|
I'm just getting started with LDAP enrollments, but I think I've come across an error in the enrol_ldap_sync.php script. It may happen other places, but this is where I've run across it. When I first ran it, I had some courses in our LDAP folder (Active Directory) that didn't exist in moodle. The script attempted to create the courses but ran into problems since I had not yet defined a template course. However, I also had not turned on auto create courses. It appears that on line 219 in the sync_enrolments function in the /enrol/ldap/enrol.php file it calls the create_course function without checking the YY setting.
I propose changing the following code starting at line 216:
[code]
if (!is_object($course_obj)) {
// ok, now then let's create it!
print "Creating Course $idnumber...";
$newcourseid = $this->create_course($course, true); // we are skipping fix_course_sortorder()
$course_obj = get_record( 'course', 'id', $newcourseid);
if (is_object($course_obj)) {
print "OK!\n";
} else {
print "failed\n";
}
}
[/code]
with this code:
[code]
if (!is_object($course_obj)) {
print "Creating Course $idnumber...";
if ( $CFG->enrol_ldap_autocreate ) {
// ok, now then let's create it!
$newcourseid = $this->create_course($course, true); // we are skipping fix_course_sortorder()
$course_obj = get_record( 'course', 'id', $newcourseid);
if (is_object($course_obj)) {
print "OK!\n";
} else {
print "failed\n";
}
} else {
print "Auto create (enrol_ldap_autocreate) not enabled\n";
}
}
[/code]
|
|
Description
|
I'm just getting started with LDAP enrollments, but I think I've come across an error in the enrol_ldap_sync.php script. It may happen other places, but this is where I've run across it. When I first ran it, I had some courses in our LDAP folder (Active Directory) that didn't exist in moodle. The script attempted to create the courses but ran into problems since I had not yet defined a template course. However, I also had not turned on auto create courses. It appears that on line 219 in the sync_enrolments function in the /enrol/ldap/enrol.php file it calls the create_course function without checking the YY setting.
I propose changing the following code starting at line 216:
[code]
if (!is_object($course_obj)) {
// ok, now then let's create it!
print "Creating Course $idnumber...";
$newcourseid = $this->create_course($course, true); // we are skipping fix_course_sortorder()
$course_obj = get_record( 'course', 'id', $newcourseid);
if (is_object($course_obj)) {
print "OK!\n";
} else {
print "failed\n";
}
}
[/code]
with this code:
[code]
if (!is_object($course_obj)) {
print "Creating Course $idnumber...";
if ( $CFG->enrol_ldap_autocreate ) {
// ok, now then let's create it!
$newcourseid = $this->create_course($course, true); // we are skipping fix_course_sortorder()
$course_obj = get_record( 'course', 'id', $newcourseid);
if (is_object($course_obj)) {
print "OK!\n";
} else {
print "failed\n";
}
} else {
print "Auto create (enrol_ldap_autocreate) not enabled\n";
}
}
[/code] |
Show » |
|
Thanks a lot Nate for the bug report
Saludos,
Iñaki.