ใช้ Data Mapping ใน Moodle
จากการแนะนำการใช้งาน LDAP ใน moodle กับ Active Directory ในครั้งก่อน ช่วยให้การใช้งานเป็นไปอย่างง่ายดาย เพราะใช้ username และ password จาก Active Directory ได้โดยตรง แต่ยังไม่ได้ปรับแต่งให้ดึงข้อมูลที่เป็นชื่อ – สกุล และ e-mail มาใช้งาน ซึ่งใน moodle เรียกการดึงข้อมูลนี้ว่า Data Mappings
Data Mappings ของ moodle คือ การดึงข้อมูลจาก MS Active Directory 2003 server ในฟิลด์ที่เราต้องการ ในที่นี้จะใช้งานหลัก ๆ (สำหรับผมเอง)อยู่ 3 ฟิลด์ด้วยกันคือ
First Name คือ ชื่อ
Surname คือ นามสกุล
และ Email address คือ e-mail ของคนนั้น ๆ
โดยที่ข้อมูลทั้งหมด จะอยู่ใน AD ซึ่งจะช่วยให้ผู้ใช้งานไม่ต้องกรอกข้อมูลใด ๆ เพิ่มเติม login เข้าไป ก็ใช้งานได้ทันที
ให้เราเข้าไปยังส่วนของ LDAP Server เลื่อนลงมาด้านล่างจะพบกับหัวข้อ DATA MAPPING ให้เราทำการกรอกข้อมูลดังนี้
First Name -> givenName
Surname -> sn
Email address -> mail
** มีข้อแม้เดียวคือ ต้องผ่านการใช้งาน LDAP มาก่อน หรือเชื่อมต่อกับ LDAP เสร็จสมบูรณ์แล้ว จึงจะสามารถใช้งานได้
เมื่อกรอกข้อมูลเสร็จเรียบร้อย ให้ทำการบันทึก แล้วล็อกอินด้วยชื่ออื่น ที่มีอยู่ใน Active Directory จะพบว่า ระบบจะดึงชื่อที่มีอยู่ใน Active Directory มาใช้งาน (ต้องเป็น user ที่ยังไม่เคยล็อกอินมาก่อนเท่านั้น เพราะ moodle จะเก็บ Profile ของคนที่ล็อกอินแล้วไว้ในระบบด้วย ดังนั้นจะไม่พบการเปลี่ยนแปลง ให้ลบ user นั้น ๆ ออกจาก moodle จึงจะเห็นการเปลี่ยนแปลง)
ผลลัพธ์ที่ได้คือ
ดูได้จากเมนูของผู้ดูแลระบบ Users –> Accounts –> Browse list of users
หากมีการล็อคอินเข้ามา ก็จะพบ ชื่อ – สกุล และ E-Mail ตามที่มีอยู่ใน AD ครับ
ตัวอย่างอื่น ๆ หรือดูข้อมูลจากเว็บไซต์นี้ครับ http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm
CN – Common Name | CN=Guy Thomas. Actually, this LDAP attribute is made up from givenName joined to SN. |
description | What you see in Active Directory Users and Computers. Not to be confused with displayName on the Users property sheet. |
displayName | displayName = Guy Thomas. If you script this property, be sure you understand which field you are configuring. DisplayName can be confused with CN or description. |
DN – also distinguishedName | DN is simply the most important LDAP attribute. CN=Jay Jamieson, OU= Newport,DC=cp,DC=com |
givenName | Firstname also called Christian name |
homeDrive | Home Folder : connect. Tricky to configure |
name | name = Guy Thomas. Exactly the same as CN. |
objectCategory | Defines the Active Directory Schema category. For example, objectClass = Person |
objectClass | objectClass = User. Also used for Computer, organizationalUnit, even container. Important top level container. |
physicalDeliveryOfficeName | Office! on the user’s General property sheet |
profilePath | Roaming profile path: connect. Trick to set up |
sAMAccountName | sAMAccountName = guyt. Old NT 4.0 logon name, must be unique in the domain. Can be confused with CN. |
SN | SN = Thomas. This would be referred to as last name or surname. |
userAccountControl | Used to disable an account. A value of 514 disables the account, while 512 makes the account ready for logon. |
userPrincipalName | userPrincipalName = guyt@CP.com Often abbreviated to UPN, and looks like an email address. Very useful for logging on especially in a large Forest. Note UPN must be unique in the forest. |