LDAP-Einschreibung
Diese Seite ist noch nicht vollständig übersetzt.
Die LDAP-Einschreibung wird auf der Seite Einstellungen > Website-Administration > Plugins > Einschreibung > Übersicht aktiviert (siehe Einschreibungs-Plugins verwalten) und auf der Seite Einstellungen > Website-Administration > Plugins > Einschreibung > LDAP-Einschreibung konfiguriert.
Dieser Artikel beschreibt, wie die LDAP-Einschreibung in Moodle konfiguriert wird. Die LDAP-Einschreibung funktioniert am besten, wenn auch für die Authentifizierung der Nutzer/innen ein LDAP-Server verwendet wird.
Voraussetzungen
- Sie verwenden einen LDAP-Serverals erste Authentifizierungsmethode.
- Alle Nutzer/innen haben ein uid Attribut im ihrem LDAP-Nutzer-Datensatz, das mit der Nutzer-ID in ihrem Moodle-Nutzerprofil übereinstimmt.
Beispiel
Wir betrachten das folgende einfache Beispiel:
- Zwei Kurse Math101 und Eng201.
- Zwei Trainer/innen TrainerA und TrainerB.
- DreiTeilnehmer/innen TeilnehmerD, TeilnehmerE und TeilnehmerF.
- TeilnehmerD und TeilnehmerE sind Teilnehmer/innen im Kurs Math101 und TrainerA ist Trainer/in im Kurs Math101. TeilnehmerE und TeilnehmerF sind Teilnehmer/innen im Kurs Eng201, und TrainerA und TrainerB sind beide Trainer/in im Kurs Eng201.
LDAP-Server-Konfiguration
- Definieren Sie zwei LDAP Container
ou=TeilnehmerEinschreibung
undou=TrainerEinschreibung
. - Für jeden Kurs definieren Sie einen LDAP-Gruppeneintrag (z.B. einen
posixGroup
Eintrag) in den ContainernTeilnehmerEinschreibung
undTrainerEinschreibung
. D.h. Sie definieren eineMath101 posixGroup
unterTeilnehmerEinschreibung
und eineMath101 posixGroup
unterTrainerEinschreibung
. Analog definieren Sie zweiEng201
Gruppen. Achtung: Der Name derposixGroup
muss mit der Kurs-ID des entsprechenden Moodle-Kurses übereinstimmen. Sie dürfen nicht die Kurzbezeichnung des Kurses verwenden - das würde nicht funktionieren! - Tragen Sie die entsprechenden Teilnehmer/innen und Trainer/innen als Mitglieder (
member
) in den soeben definierten LDAP-Gruppen ein: Tragen Sie dasuid
Attribut der Nutzer/innen (idnumber) in dasmemberUid
Attribut der entsprechenden Gruppe ein:TrainerA
ist Mitglied in derMath101
Gruppe unterTrainerEinschreibung
.TeilnehmerD
undTeilnehmerE
sind Mitglieder derMath101
Gruppe unterTeilnehmerEinschreibung
.TrainerA
undTrainerB
sind Mitglieder derEng201
Gruppe unterTrainerEinschreibung
.TeilnehmerE
undTeilnehmerF
sind Mitglieder derEng201
Gruppe unterTeilnehmerEinschreibung
.
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 (use 'member' -without the quotes- for Active Directory) |
enrol_ldap_teacher_contexts: | ou=TeacherEnrollment,dc=ldapserver,dc=tmcc,dc=edu |
enrol_ldap_teacher_memberattribute: | memberUid (use 'member' -without the quotes- for Active Directory) |
enrol_ldap_objectclass: | posixGroup (use 'group' -without the quotes- for Active Directory) |
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).
Automatic course creation
Courses can be created automatically if there are LDAP enrolments to a course that doesn't yet exist in Moodle. To enable this, set enrol_ldap_autocreate to Yes.
enrol_ldap_category field sets the category for the automatically created courses.
enrol_ldap_template field can contain the shortname of a course that is used as a template in the automatic course creation.
Notes:
- 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.
- 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.
- 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.
- 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).
- User passwords for this setup are defined in the attached .ldif file.
- If you use the attached .ldif file, you'll need to edit the ldap server information (the "dn=" lines).
Other LDAP Layout
I do suggest to create a new LDAP object, say moodleCourse, which contains all information,& members of the course, including teachers, students a.s.o. For instance (OpenLDAP):
attributetype ( oidAttrBase:44 NAME ( 'teacherUid' ) SUP memberUid DESC 'which person is a teacher of this course' ) objectclass ( oidObjRoot:14 NAME 'moodleCourse' SUP top STRUCTURAL DESC 'course available in Moodle' MUST ( cn ) MAY ( owner $ gn $ sn $ seeAlso $ description $ memberUid $ teacherUid ) ) Note: Openldap 2.x will need something like: attributetype ( 1.2.1.1.1.1.2.1 NAME 'teacherUid' SUP memberUid DESC 'which person is a teacher of this course' EQUALITY caseExactIA5Match SUBSTR caseExactIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) objectclass ( 1.2.1.1.1.1.1.1 NAME 'moodleCourse' SUP top STRUCTURAL DESC 'course available in Moodle' MUST ( cn ) MAY ( owner $ gn $ sn $ seeAlso $ description $ memberUid $ teacherUid ) )
The configuration is like this, in bold you see required changes, in italic you see useful changes.
LDAP Enrollment Variable: | Value: |
---|---|
enrol_ldap_student_contexts: | ou=moodle,ou=groups,dc=ldapserver,dc=tmcc,dc=edu |
enrol_ldap_student_memberattribute: | memberUid |
enrol_ldap_teacher_contexts: | ou=moodle,ou=groups,dc=ldapserver,dc=tmcc,dc=edu |
enrol_ldap_teacher_memberattribute: | teacherUid |
enrol_ldap_objectclass: | moodleGroup |
enrol_ldap_course_idnumber: | cn |
enrol_ldap_course_shortname: | givenname |
enrol_ldap_course_fullname: | sn |
enrol_ldap_course_summary: | description |
enrol_ldap_autocreate: | Yes |
Note: The enrol_ldap_course_idnumber (cn in my setup) is used to identify the course by the LDAP enrolment script and the database uses an INTEGER numeric here, in Moodle v1.8 anyway. When you
call cd enrol/ldap/ && php -f enrol_ldap_sync.php
any course with the same idnumber is updated, hence,
it is quite important for the LDAP synchronisation and needs to be unique.
Sample of an moodleCourse LDAP object:
dn: cn=851,ou=moodle,ou=groups,dc=ldapserver,dc=tmcc,dc=edu objectClass: moodleCourse cn: 851 givenName: LV851 sn: 2007S/Introduction to Moodle description: Jahr: 2007 Sommer, <A TARGET=_blank HREF="https://other_server/display/851">Announcement</A> teacherUid: userA memberUid: user1
In the same fashion one can add all the other role mappings.
Siehe auch
- LDAP auth and enrolment set-up guide (PDF 227KB) - Anleitung zur Konfiguration der Authentifizierung und Einschreibung über einen LDAP-Server
- Wikipedia-Artikel zu LDAP
Diskussionsbeiträge im Kurs Using Moodle auf moodle.org