Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix user capability check during login redirects #232

Merged
merged 2 commits into from
May 4, 2023

Conversation

earnjam
Copy link
Member

@earnjam earnjam commented May 4, 2023

This should resolve the user capability check issue that was introduced with #231

@earnjam earnjam requested review from arunshenoy99 and circlecube May 4, 2023 13:38
@earnjam earnjam marked this pull request as ready for review May 4, 2023 13:53
Copy link
Member

@arunshenoy99 arunshenoy99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the quick fix!

@earnjam
Copy link
Member Author

earnjam commented May 4, 2023

Just to add a side note here regarding removing the user capability check abstractions in this method:

With any abstractions, it's a bit subjective as to where the line is to create them. But I think in general it is best to try to stay closer to core WP functions when possible. That may mean we have some minor redundancy or repetition of code when checking values (Example: checking that $user is an instance of WP_User here, or explicitly passing the manage_options capability), but it also means that anyone familiar with WordPress who is reading the code can easily see and understand what it's doing. It reduces some of the required mental overhead and file/class jumping when trying to understand or review a piece of code.

With JS, every character counts toward the downloaded file size for the user, so making code shorter tends to be better. But with PHP I tend to lean toward being more verbose for clarity over slimming down into minor abstractions because there is no real performance cost for doing so.

@arunshenoy99 arunshenoy99 merged commit b0b9e1b into trunk May 4, 2023
@arunshenoy99 arunshenoy99 deleted the login-sso-redirect branch May 4, 2023 15:25
@earnjam earnjam restored the login-sso-redirect branch May 4, 2023 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants