-
Notifications
You must be signed in to change notification settings - Fork 315
Closed
Labels
P0High priorityHigh priorityType: EnhancementImprovement of an existing featureImprovement of an existing feature
Milestone
Description
Feature Description
Site Kit should pass a comma-separated list of the current user's roles in a user_roles
query parameter as part of the proxy setup URL.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The proxy setup URL should contain a
user_roles
query parameter, which should be the current user's roles, separated by comma.- In most cases there will just be one role, but WordPress allows for multiple roles, which several plugins use, so that should be covered.
- If multisite,
network_administrator
should also be considered a role. Whether the user has this, can be checked viacurrent_user_can( 'manage_network' )
.
- Since related areas are being updated here, we should also remove the legacy
admin_root
query parameter that hasn't been in use on the proxy for a couple months by now.
Implementation Brief
- Add method
Google_Proxy::get_user_fields()
that returns an array withuser_roles
key and a comma-separated string list of the current user's roles. - Get the roles via
wp_get_current_user()->roles
. - If
is_multisite() && current_user_can( 'manage_network' )
, includenetwork_administrator
in the list manually. - In
OAuth_Client::get_proxy_setup_url()
, merge theGoogle_Proxy::get_user_fields()
in unconditionally, with similar handling like the existing site fields. - Remove
admin_root
fromGoogle_Proxy::get_site_fields()
. - Merge Pass user_roles query parameter in proxy setup URL #1640.
QA Brief
Changelog entry
- Pass
user_roles
query parameter during setup.
Metadata
Metadata
Assignees
Labels
P0High priorityHigh priorityType: EnhancementImprovement of an existing featureImprovement of an existing feature