Note: You are currently viewing documentation for Moodle 3.3. Up-to-date documentation for the latest stable version of Moodle is probably available here: LDAP enrolment.

LDAP enrolment: Difference between revisions

From MoodleDocs
(Put the Enrolment HOWTO inline here.)
(→‎LDAP Enrollment HOWTO (by Lars Jensen): ++ link to LDAP authentication)
Line 1: Line 1:
== LDAP Enrollment HOWTO (by Lars Jensen) ==
== LDAP Enrollment HOWTO (by Lars Jensen) ==


This howto describes how to set up LDAP enrollment in Moodle. LDAP enrollment works best in moodle when used in conjunction with LDAP authentication, and we're going to assume that you have already set moodle up for LDAP authentication.
This howto describes how to set up LDAP enrollment in Moodle. [[LDAP enrolment]] works best in moodle when used in conjunction with [[LDAP authentication]], and we're going to assume that you have already set moodle up for LDAP authentication.


=== Assumptions ===
=== Assumptions ===

Revision as of 09:03, 13 September 2006

LDAP Enrollment HOWTO (by Lars Jensen)

This howto describes how to set up LDAP enrollment in Moodle. LDAP enrolment works best in moodle when used in conjunction with LDAP authentication, and we're going to assume that you have already set moodle up for LDAP authentication.

Assumptions

  1. You are running a recent version of moodle. We have tested the setup presented here on versions 1.5.2+ and 1.6dev. It is likely to work on moodle 1.4.5 as well.
  2. You are using LDAP authentication as your primary authentication method.
  3. Each user in has a uid attribute in the users LDAP record, that matches the “ID number” in the same users moodle profile (this can easily be arranged with a mapping on the moodle LDAP Authentication setup page).

The Course Setup

Our setup involves the following course and user definitions:

  • Two courses, Math101 and Eng201.
  • Two teachers, teachera and teacherb.
  • Three students, studentd, studente, and studentf.
  • studentd and studente are enrolled as students in Math101, and teachera is enrolled as teacher of Math101. studente and studentf are enrolled as students in Eng201, and teachera and teacherb are both enrolled as teachers of Eng201.

The LDAP Container Setup

  1. Define two LDAP containers ou=StudentEnrollment and ou=TeacherEnrollment
  2. For each course we define an LDAP group entry (e.g a posixGroup entry) in the StudentEnrollment and TeacherEnrollment containers. Thus, we define a Math101 posixGroup under StudentEnrollment, and we define a Math101 posixGroup under TeacherEnrollment. We define the two Eng201 groups in a similar way.
  3. Enroll students and teachers as members of in the LDAP-groups we just defined. This is done by entering the users uid attribute in the memberUid attribute of the relevant group:
    • teachera is a member of the Math101 group under TeacherEnrollment.
    • studentd and studente are a members of the Math101 group under StudentEnrollment.
    • teachera and teacherb are members of the Eng201 group under TeacherEnrollment
    • studente and studentf are a members of the Eng201 group under StudentEnrollment.

The LDAP Enrollment Configuration in Moodle

The LDAP enrollment settings in moodle corresponding to the above setup are as follows:

LDAP Enrollment Variable: Value:
enrol_ldap_student_contexts: ou=StudentEnrollment,dc=ldapserver,dc=tmcc,dc=edu
enrol_ldap_student_memberattribute: memberUid
enrol_ldap_teacher_contexts: ou=TeacherEnrollment,dc=ldapserver,dc=tmcc,dc=edu
enrol_ldap_teacher_memberattribute: memberUid
enrol_ldap_objectclass: posixGroup
enrol_ldap_course_idnumber: cn
enrol_ldap_course_shortname: cn
enrol_ldap_course_fullname: cn
enrol_ldap_autocreate: Yes

Additionally, since you are using LDAP authentication, you should also map the moodle "ID number" of users to the "uid" in the ldap entry of the user. This is done on the moodle LDAP Authentication page (not the LDAP Enrollment page).

Notes:

  1. You do not need to create the courses manually in moodle. If they don't exist, they will be created when the first enrolled user login.
  2. We are using the same string cn and uid in a users LDAP record. This is not necessary, I believe. However, if you use different values, you will need to define the ldap_user_attribute to uid in the LDAP authentication setup.
  3. The value of the group id number (gidNumber) defined for the groups in step 2 of the LDAP Container Setup above is not critical. It is not used in this setup.
  4. The attached .ldif file assumes that users are in the ou=People container in LDAP. You will need to configure your LDAP Authentication setup to reflect this (ldap_contexts variable).
  5. User passwords for this setup are defined in the attached .ldif file.
  6. If you use the attached .ldif file, you'll need to edit the ldap server information (the "dn=" lines).

See also