Allow to modify UserQuery in getByUsernameOrEmail #216
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have some CraftCMS sites that use Azure as IDP. We need to match those users based on the objectidentifier (http://schemas.microsoft.com/identity/claims/objectidentifier) which we save in a Craft field in the users fieldlayout. However the code always assumes the NameID override is for the username or email attribute.
There currently is an open issue with someone having the same problem: #204.
This fix will make it so that you are able to influence the UserQuery and return a different result. It is also possible to only change the
$usernameOrEmail
or$archived
variable with this event.Example how you could modify the UserQuery (in a plugin or module):
I branched from the
2.7.5
tag, since some of our websites are still running on Craft 3.Edit: The master has been merged into the branch and there are no more remaining conflicts.
If you accept this fix: can you make a new tag for this? For both Craft3/Craft4/Craft5. All of those versions have the same code.
Thanks!