Multisite: Introduce a setup_network capability for setting up multisite.

`setup_network` is a new meta capability that brings more granular control over the permissions to setup a multisite environment. In a non-multisite environment it falls back to `manage_options` while in a multisite it falls back to `manage_network_options`. The introduction of this capability furthermore allows replacing an `is_super_admin()` check.

Props ashokkumar24 for the original patch.
Fixes #39206. See #37616.


git-svn-id: https://develop.svn.wordpress.org/trunk@40390 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Felix Arntz
2017-04-07 12:52:24 +00:00
parent ca0aa133ff
commit 3ca0673036
5 changed files with 12 additions and 3 deletions

View File

@@ -15,7 +15,7 @@ define( 'WP_INSTALLING_NETWORK', true );
/** WordPress Administration Bootstrap */
require_once( dirname( __FILE__ ) . '/admin.php' );
if ( ! is_super_admin() ) {
if ( ! current_user_can( 'setup_network' ) ) {
wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
}