MDL-69304 gradeimport_csv: Validate if the user id is numerical.

This commit is contained in:
Shintaro Fujiwara
2021-03-26 04:45:52 +09:00
parent d65ed58e73
commit 48bce2cee1
+4
View File
@@ -240,6 +240,10 @@ class gradeimport_csv_load_data {
$select = "{$field} = :{$field}";
}
// Validate if the user id value is numerical.
if ($field === 'id' && !is_numeric($value)) {
$errorkey = 'usermappingerror';
}
// Make sure the record exists and that there's only one matching record found.
$user = $DB->get_record_select('user', $select, array($userfields['field'] => $value), '*', MUST_EXIST);
} catch (dml_missing_record_exception $missingex) {