Profile field mapping function called twice on each successful auth_oidc user login #1437
Labels
Issue type - bug
Bugs in existing code that needs to be fixed.
Triaging status - triaged
A ticket has been created accordingly in the maintainers' ticket system.
Milestone
In pull requests #1197, which was used as base for #1290 and #1291, introduced a logic in which profile field mapping is called directly within the login process of an auth_oidc user, to fix an issue in which newly created Moodle account from initial login misses necessary profile data. This caused the field mapping function being called twice - the first time in auth_oidc plugin, and a second time in the observer function in local_o365 that listens for user logged event. This is wrong, and may cause performance issue, and may even result in throttling in Graph API calls in extreme cases.
I'd like to propose a solution here, to keep the call to the function to field mapping function in auth_oidc plugin, and update the call in the observer function to only run if the user doesn't have auth_oidc set as authentication method. This would be a user who doesn't use auth_oidc authentication type, but is matched to an Azure account. Field mapping needs to run for such users, and it is not triggered as part of their login.
This fix will be included in the next release.
The text was updated successfully, but these errors were encountered: