Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

User:Ratana Lim

From MoodleDocs

USER ACCOUNT DESIGN PROBLEM

Here is the problem I've been battling over the years with Moodule user account design: The same person have multiple accounts on Moodle user table depending on the authentication method. Here is an example.

| id   | firstname | lastname | email              | usrname     | auth       | idnumber  |
|1000  | Rt        | Lm       | ratana@ucsb....    | ratana      | ldap       | 999999999 |
|10001 | Rt        | Lm       | ratana@ic.ucsb...  | ratana@ic   | externaldb | 999999999 |
|10002 | Rt        | Lm       | ratana@lsit.ucsb...| ratana@lsit | mnet       |           |

I am the person that have all the different records in the user table.

Problem #1: I have 3 different accounts in my moodle instance
Problem #2: How does an instructor knows which one to enroll me in if it is done manually?

The two main problem ought to be enought to refactor user accounts in the database and the authentication method. User (the same person) ought to have one user record but allow for diferent authentication methods (perhaps including the username/aliases to authenticate by). Also user ought to maintain a primary email or contact methods independent of the database account record.

There must exists a standard design pattern for account--I cannot seems to locate a good reference on the internet. DB wise, the user table in Moodle needs to be normalized a bit more to accommendate a standard design that supports one account per real user regardless of authentication methods, emails, etc.