Query using the following fields for
\gradeimport_csv_load_data::check_user_exists() should be done in a
case-insensitive manner:
* email - As agreed in MDL-29315
* username - Although usernames can only be in lowercase during
registration, usernames are being handled in a case-insensitive
fashion when logging in. It makes sense to make check_user_exists()
consistent with this behaviour.
* We need to ensure that we are checking the correct user account.
Since email and idnumber are not unique fields, there's a chance that
multiple user records will match when querying for user data using
these fields. This might lead to a different user's grades being
inadvertently modified during grade import. In such a case, this
function needs to return a null userid.