-
Bug
-
Resolution: Fixed
-
Minor
-
3.3.1, 3.4
-
MOODLE_33_STABLE, MOODLE_34_STABLE
-
MOODLE_33_STABLE
-
MDL-59511-master-oauthsysmail -
Currently, both fields "username" and "email" are marked NOT NULL in lib/db/install.xml (https://github.com/moodle/moodle/blob/350700bf8b509f5269b0fefd34fec0d3d5393c99/lib/db/install.xml#L3519). However, there are OAuth 2 providers that do not require an email adress for their user accounts, which therefore cannot provide a reliable value in the corresponding field of a userinfo_endpoint. Both ownCloud and Nextcloud allow users to provide an email address, but this is not enforced e.g. when accounts are created by an admin manually (Try for yourself: Instant trial on https://demo.nextcloud.com/#short-term; Log in as admin//admin, click the Settings cog > Users and add a new user).
(Partly related: Both services do not (yet) provide a userinfo endpoint, so I currently have to mock it – but as soon as they do, the email might not always be part of it )
I suggest that the email field can be NULL-able. I don't know of any services that do not provide a username, so that one can remain NOT NULL imo.