Skip to content

Add per-network super-admin scoping to REST sites controller - #8

Merged
lloc merged 1 commit into
lloc:feature/40365-rest-sites-endpointfrom
spacedmonkey:feature/40365-rest-sites-endpoint-super-admin
Sep 30, 2026
Merged

lloc merged 1 commit into
lloc:feature/40365-rest-sites-endpointfrom
spacedmonkey:feature/40365-rest-sites-endpoint-super-admin

Conversation

@spacedmonkey

Copy link
Copy Markdown

Summary

  • Adds per-network super-admin scoping (is_super_admin( $user_id, $network_id ), get_super_admins( $network_id )) so super-admin status can be checked against a specific network, not just the current one.
  • Uses this in the wp/v2/sites REST controller's permission checks (check_network_ids_exist() / check_network_access()) for the list, single-item, create, and update routes, so a network's own site_admins option can scope access to sites on that network.
  • Adds PHPUnit coverage for the new network-id validation and cross-network access behavior on those routes.

Test plan

  • npm run test:php -- --filter WP_Test_REST_Sites_Controller (single-site)
  • npm run test:php -- -c tests/phpunit/multisite.xml --filter WP_Test_REST_Sites_Controller (multisite)
  • Manual REST testing against a multi-network install for permission checks (super admin vs. non-super-admin, cross-network access)

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props spacedmonkey.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@lloc
lloc merged commit 21377c7 into lloc:feature/40365-rest-sites-endpoint Sep 30, 2026
3 checks passed
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