Kurseinschreibung über LDAP: Unterschied zwischen den Versionen
K (hat „Einschreibung über LDAP“ nach „Kurseinschreibung über LDAP“ verschoben) |
|
(kein Unterschied)
|
Version vom 25. September 2009, 09:29 Uhr
Diese Seite ist noch nicht vollständig übersetzt.
Siehe en:LDAP enrolment
Location: LDAP edit settings link in Administration > Kurse > Einschreibung
Wie man das Einschreiben in einen Kurs via LDAP einrichtet
Hier wird beschrieben, wie man LDAP-Einschreibung einrichtet (erste Version von Lars Jensen). Einschreibung über LDAP arbeitet am besten, wenn in Moodle ebenfalls Authentifizierung über LDAP genutzt wird. Entsprechend gehe ich davon aus, dass Sie bereits LDAP-Authentifizierung eingerichtet haben. Für Schulen kann ich nur dringend dazu raten, einen LDAP-Authentifizierung plus LDAP-Einschreibung einzurichten. Der administrative Aufwand sinkt dadurch auf ein Minimum, während gleichzeitig weniger Fragen von Lehrern und Schüler zu erwarten sind.
Das Ziel
Ihr M$-2K3-Server kennt Klassen, denen Schüler zugeordnet sind. Sie wollen,
- dass Moodle automatisch einen Klassenraum einrichtet, sobald ein Schüler der Klasse sich einloggt.
- dass jeder Schüler einer Klasse automatisch freien Zutritt zu seiner Klasse hat, ohne administratives Zutun.
Möglicherweise wollen Sie auch, dass auch Lehrer automatisch ihrer Klasse zugeordenet werden. Das klappt natürlich nur, wenn LDAP diese Information auch tatsächlich abbildet. Bei uns ist das nicht der Fall, was aber meines Erachtens vollkommen unproblematisch ist. Ohnehin lege ich die Lehrer alle per Bulk-Upload an,
- weil das schnell gemacht ist,
- weil ich so alle Lehrer in Moodle erfasst habe, auch wenn sie noch nicht in Moodle angemeldet waren. So kann i beispielsweise vorm ersten Login Lehrer in gewünschten Kursen einschreiben,
- weil Single-Sign-In natürlich trotzdem prima funktioniert, auch wenn die Lehrer über eine Textdatei angelegt wurden.
Annahmen
- Ich habe die Einschreibung über LDAP auf Moodle 1.9.2 getestet. Andere Versionen sollten auch klappen.
- Sie nutzen bereits LDAP-Authentifizierung.
- Meine Angaben beziehen sich leider nur auf einen M$ W2k3-Server. Alternative LDAP-Server werden bestimmt auch funktionieren, aber möglicherweise nicht so wie hier beschrieben.
- Jeder User hat eine eindeutige ID-Nummer. Um das sicherzustellen gehen zur LDAP-Authentifizierung und geben Sie ganz unten im Bereich "Data Mapping" unter ID-Nummer "distinguishedName" ohne Anfürungszeichen ein (Siehe Abbildung). Im Falle von OpenLDAP (und anderen RFC2307 kompatiblen LDAP-Servern sollte hier "cn" zielführend sein.
Das Aussehen der Kurse
Unser Setup schließt folgende Kurs- und Nutzerangaben ein:
- Zwei Kurse, Math101 und Eng201.
- Zwei Lehrer, LehrerA und LehrerB.
- Drei Schüler, SchuelerD, SchuelerE und SchuelerF.
- SchuelerD und SchuelerE sind als Schüler im Kurs Math101 eingeschrieben, LehrerA ist als Lehrer im Kurs Math101 eingeschrieben. SchuelerE und SchuelerF sind als Schüler im Kurs Eng201 eingeschrieben,
LehrerA und LehrerB sind als Lehrer im Kurs Eng201 eingeschrieben.
The LDAP Container Setup
- Define two LDAP containers ou=StudentEnrollment and ou=TeacherEnrollment
- 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. Be careful, the name of the posixGroup has to match the Course ID number of the Moodle course. Do not use the course short name, it will not work.
- Enroll students and teachers as members of in the LDAP-groups we just defined. This is done by entering the users uid attribute (idnumber) 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 (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).
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.
See also
- Some User authentication forum discussion threads:
- Forum discussion: LDAP Enrollment HOWTO with Lars Jensen's 2005 post.
- Forum discussion: LDAP Auto enrollment
- Forum discussion: LDAP nightmare Part II
- Forum discussion: Moodle + AD + LDAP = Confusion - Help Required and Provided
- Wikipedia on LDAP: a great deal of information beyond the context of Moodle