-
Notifications
You must be signed in to change notification settings - Fork 800
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
SSO: Show wp-admin login form if site has local users #39139
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works nicely
$connection_manager = new \Automattic\Jetpack\Connection\Manager( 'jetpack' ); | ||
$users = get_users( array( 'fields' => array( 'ID' ) ) ); | ||
foreach ( $users as $user ) { | ||
if ( ! $connection_manager->is_user_connected( $user->ID ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this perform for large sites? > 10k users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! I have no idea 😅 I'll see if there is an easy way to populate a test site with 10k fake users and check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say though that if a site has 10k users, it's very likely that most of them will be non-connected, and we'll stop the loop when the first one is found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imo, that's just one scenario. If 4.9k users are connected there would be a higher performance penalty. This has an O(n) complexity.
Stops enforcing the WP.com login for Atomic sites with local users. Previously, we were disabling the enforced WP.com login on sites with the classic interface (except for users coming from Calypso), and kept it on sites with the default interface. However, sites with the default interface can have local users as well (users not connected to WP.com) who are unable to use their wp-admin credentials to log in into wp-admin. This commit fixes that by changing who is enforced to log in with a WP.com account: - Sites without local users: - WP.com login, always. - Sites with local users: - If user comes from Calypso: WP.com login - Otherwise: Jetpack SSO login, so they can decide whether to use a WP.com account or a local account.
Fixes #39037
Proposed changes:
Stops enforcing the WP.com login for Atomic sites with local users.
Previously, we were disabling the enforced WP.com login on sites with the classic interface (except for users coming from Calypso), and kept it on sites with the default interface.
However, sites with the default interface can have local users as well (users not connected to WP.com) who are unable to use their wp-admin credentials to log in into wp-admin.
This PR fixes that by changing who is enforced to log in with a WP.com account:
Other information:
Jetpack product discussion
pc4f5j-4Ky-p2
Does this pull request change what data or activity we track or use?
No
Testing instructions:
wpcomsh
)./wp-admin/users.php
/wp-admin
/wp-admin