fix(UserPlugin): Rewrite from scratch #57511
Open
+94
−215
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.
The code was extremely messy and unorganized, making it impossible to understand how it works. I rewrote it from scratch and it should be a lot easier to understand what the different options do now. I haven't adjusted the tests yet, as I first want to have some reviews to validate that the new implementation is correct (I don't trust the tests at all, they are pretty badly written). Do not read the diff, it's too big and useless.
This fixes one major flaw, as email full matches in combination with restriction to group weren't working, because the users to be searched for email fullmatches were empty due to the group restriction. This can also be seen in the TODO in the code, where the email search was implemented. This TODO still needs to be addressed, as the current email search implementation will not scale well. I will also add a test for this exact scenario.