[5.4] Fix issue with case in authorizeResource #18435
Merged
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.
Should fix issue #18432
Will add some tests this evening.
Problem:
When using the "authorizeResource" method, by default, the method derives the parameter name from the passed model if it is not given as the secoond parameter. However, "strtolower" is used. If the model name contains multiple words, ie. "ProductionOrder", then the parameter becomes "productionorder", which will not work. We need "productionOrder".
So, currently, authorizeResource will always return false, unless the second parameter is provided as "productionOrder".
Solution:
Simply change the following line:
to