mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 08:11:52 +01:00
Multisite: Introduce an upgrade_network
capability.
Prior to this change, a mix of `is_super_admin()` calls and `manage_network` capability checks was used to determine whether the current user could upgrade the network. With this changeset a dedicated capability is introduced that allows more granular handling. Props dhanendran for the original patch. Fixes #39205. See #37616. Built from https://develop.svn.wordpress.org/trunk@40404 git-svn-id: http://core.svn.wordpress.org/trunk@40311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4e1f22bf78
commit
9354ea683f
@ -785,7 +785,7 @@ function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
|
||||
function site_admin_notice() {
|
||||
global $wp_db_version, $pagenow;
|
||||
|
||||
if ( ! is_super_admin() ) {
|
||||
if ( ! current_user_can( 'upgrade_network' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ if ( $update_data['counts']['total'] ) {
|
||||
$submenu['index.php'][10] = array( __( 'Updates' ), 'update_core', 'update-core.php' );
|
||||
}
|
||||
|
||||
$submenu['index.php'][15] = array( __( 'Upgrade Network' ), 'manage_network', 'upgrade.php' );
|
||||
$submenu['index.php'][15] = array( __( 'Upgrade Network' ), 'upgrade_network', 'upgrade.php' );
|
||||
|
||||
$menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
|
||||
|
||||
|
@ -32,8 +32,9 @@ get_current_screen()->set_help_sidebar(
|
||||
|
||||
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
||||
|
||||
if ( ! current_user_can( 'manage_network' ) )
|
||||
if ( ! current_user_can( 'upgrade_network' ) ) {
|
||||
wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
|
||||
}
|
||||
|
||||
echo '<div class="wrap">';
|
||||
echo '<h1>' . __( 'Upgrade Network' ) . '</h1>';
|
||||
|
@ -478,6 +478,7 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
case 'manage_network_plugins':
|
||||
case 'manage_network_themes':
|
||||
case 'manage_network_options':
|
||||
case 'upgrade_network':
|
||||
$caps[] = $cap;
|
||||
break;
|
||||
case 'setup_network':
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.8-alpha-40400';
|
||||
$wp_version = '4.8-alpha-40404';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user