这是indexloc提供的服务,不要输入任何密码
Skip to content

Pass user_roles query parameter in proxy setup URL #1639

@felixarntz

Description

@felixarntz

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 via current_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 with user_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' ), include network_administrator in the list manually.
  • In OAuth_Client::get_proxy_setup_url(), merge the Google_Proxy::get_user_fields() in unconditionally, with similar handling like the existing site fields.
  • Remove admin_root from Google_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

No one assigned

    Labels

    P0High priorityType: EnhancementImprovement of an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions