Privacy: Revert [47269] for now to address side effects on Multisite installations.

See #44176.
Built from https://develop.svn.wordpress.org/trunk@47280


git-svn-id: http://core.svn.wordpress.org/trunk@47080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-02-11 21:48:06 +00:00
parent 652966a2a5
commit 63ed0401a0
5 changed files with 10 additions and 51 deletions

View File

@ -695,7 +695,6 @@ function populate_roles() {
populate_roles_270();
populate_roles_280();
populate_roles_300();
populate_roles_540();
}
/**
@ -924,27 +923,6 @@ function populate_roles_300() {
}
}
/**
* Create and modify WordPress roles for WordPress 5.4.0.
*
* @since 5.4.0
*/
function populate_roles_540() {
// Add the privacy caps to the Administrators.
$role = get_role( 'administrator' );
if ( ! empty( $role ) ) {
$role->add_cap( 'export_others_personal_data' );
$role->add_cap( 'erase_others_personal_data' );
$role->add_cap( 'manage_privacy_options' );
}
$role = get_role( 'editor' );
if ( ! empty( $role ) ) {
$role->add_cap( 'manage_privacy_options' );
}
}
if ( ! function_exists( 'install_network' ) ) :
/**
* Install Network.

View File

@ -834,10 +834,6 @@ function upgrade_all() {
upgrade_530();
}
if ( $wp_current_db_version < 47269 ) {
upgrade_540();
}
maybe_disable_link_manager();
maybe_disable_automattic_widgets();
@ -2158,22 +2154,6 @@ function upgrade_530() {
}
}
/**
* Executes changes made in WordPress 5.4.0.
*
* @ignore
* @since 5.4.0
*
* @global int $wp_current_db_version The old (current) database version.
*/
function upgrade_540() {
global $wp_current_db_version;
if ( $wp_current_db_version < 47269 ) {
populate_roles_540();
}
}
/**
* Executes network-level upgrade routines.
*

View File

@ -288,11 +288,7 @@ if ( ! is_multisite() && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE )
$submenu['tools.php'][50] = array( __( 'Network Setup' ), 'setup_network', 'network.php' );
}
$menu[80] = array( __( 'Settings' ), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
if ( current_user_can( 'manage_privacy_options' ) && ! current_user_can( 'manage_options' ) ) {
$menu[80] = array( __( 'Settings' ), 'manage_privacy_options', 'options-privacy.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
}
$menu[80] = array( __( 'Settings' ), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
$submenu['options-general.php'][10] = array( _x( 'General', 'settings screen' ), 'manage_options', 'options-general.php' );
$submenu['options-general.php'][15] = array( __( 'Writing' ), 'manage_options', 'options-writing.php' );
$submenu['options-general.php'][20] = array( __( 'Reading' ), 'manage_options', 'options-reading.php' );

View File

@ -132,7 +132,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
* so deleting it should require that too.
*/
if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) {
$caps[] = 'manage_privacy_options';
$caps = array_merge( $caps, map_meta_cap( 'manage_privacy_options', $user_id ) );
}
break;
@ -203,7 +203,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
* so editing it should require that too.
*/
if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) {
$caps[] = 'manage_privacy_options';
$caps = array_merge( $caps, map_meta_cap( 'manage_privacy_options', $user_id ) );
}
break;
@ -580,6 +580,11 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
$caps[] = 'update_core';
}
break;
case 'export_others_personal_data':
case 'erase_others_personal_data':
case 'manage_privacy_options':
$caps[] = is_multisite() ? 'manage_network' : 'manage_options';
break;
default:
// Handle meta capabilities for custom post types.
global $post_type_meta_caps;

View File

@ -13,14 +13,14 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-47279';
$wp_version = '5.4-alpha-47280';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
*
* @global int $wp_db_version
*/
$wp_db_version = 47269;
$wp_db_version = 47018;
/**
* Holds the TinyMCE version.