diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php
index 0f1f0f4..0dee29d 100644
a
|
b
|
function wp_ajax_wp_privacy_erase_personal_data() { |
4869 | 4869 | function wp_ajax_health_check_dotorg_communication() { |
4870 | 4870 | check_ajax_referer( 'health-check-site-status' ); |
4871 | 4871 | |
4872 | | if ( ! current_user_can( 'install_plugins' ) ) { |
| 4872 | if ( ! current_user_can( 'view_health_statuses' ) ) { |
4873 | 4873 | wp_send_json_error(); |
4874 | 4874 | } |
4875 | 4875 | |
… |
… |
function wp_ajax_health_check_dotorg_communication() { |
4889 | 4889 | function wp_ajax_health_check_is_in_debug_mode() { |
4890 | 4890 | wp_verify_nonce( 'health-check-site-status' ); |
4891 | 4891 | |
4892 | | if ( ! current_user_can( 'install_plugins' ) ) { |
| 4892 | if ( ! current_user_can( 'view_health_statuses' ) ) { |
4893 | 4893 | wp_send_json_error(); |
4894 | 4894 | } |
4895 | 4895 | |
… |
… |
function wp_ajax_health_check_is_in_debug_mode() { |
4909 | 4909 | function wp_ajax_health_check_background_updates() { |
4910 | 4910 | check_ajax_referer( 'health-check-site-status' ); |
4911 | 4911 | |
4912 | | if ( ! current_user_can( 'install_plugins' ) ) { |
| 4912 | if ( ! current_user_can( 'view_health_statuses' ) ) { |
4913 | 4913 | wp_send_json_error(); |
4914 | 4914 | } |
4915 | 4915 | |
… |
… |
function wp_ajax_health_check_background_updates() { |
4930 | 4930 | function wp_ajax_health_check_loopback_requests() { |
4931 | 4931 | check_ajax_referer( 'health-check-site-status' ); |
4932 | 4932 | |
4933 | | if ( ! current_user_can( 'install_plugins' ) ) { |
| 4933 | if ( ! current_user_can( 'view_health_statuses' ) ) { |
4934 | 4934 | wp_send_json_error(); |
4935 | 4935 | } |
4936 | 4936 | |
… |
… |
function wp_ajax_health_check_loopback_requests() { |
4950 | 4950 | function wp_ajax_health_check_site_status_result() { |
4951 | 4951 | check_ajax_referer( 'health-check-site-status-result' ); |
4952 | 4952 | |
4953 | | if ( ! current_user_can( 'install_plugins' ) ) { |
| 4953 | if ( ! current_user_can( 'view_health_statuses' ) ) { |
4954 | 4954 | wp_send_json_error(); |
4955 | 4955 | } |
4956 | 4956 | |
… |
… |
function wp_ajax_health_check_site_status_result() { |
4967 | 4967 | function wp_ajax_health_check_get_sizes() { |
4968 | 4968 | check_ajax_referer( 'health-check-site-status-result' ); |
4969 | 4969 | |
4970 | | if ( ! current_user_can( 'install_plugins' ) || is_multisite() ) { |
| 4970 | if ( ! current_user_can( 'view_health_statuses' ) || is_multisite() ) { |
4971 | 4971 | wp_send_json_error(); |
4972 | 4972 | } |
4973 | 4973 | |
diff --git a/wp-admin/menu.php b/wp-admin/menu.php
index d126339..f7cc775 100644
a
|
b
|
$menu[75] = array( __( 'Tools' ), 'edit_posts', 'tools.php', |
263 | 263 | $submenu['tools.php'][5] = array( __( 'Available Tools' ), 'edit_posts', 'tools.php' ); |
264 | 264 | $submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' ); |
265 | 265 | $submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' ); |
266 | | $submenu['tools.php'][20] = array( __( 'Site Health' ), 'install_plugins', 'site-health.php' ); |
| 266 | $submenu['tools.php'][20] = array( __( 'Site Health' ), 'view_health_statuses', 'site-health.php' ); |
267 | 267 | if ( is_multisite() && ! is_main_site() ) { |
268 | 268 | $submenu['tools.php'][25] = array( __( 'Delete Site' ), 'delete_site', 'ms-delete-site.php' ); |
269 | 269 | } |
diff --git a/wp-admin/site-health-info.php b/wp-admin/site-health-info.php
index 42f2be0..8e095b2 100644
a
|
b
|
require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 | |
12 | 12 | $title = __( 'Site Health Info' ); |
13 | 13 | |
14 | | if ( ! current_user_can( 'install_plugins' ) ) { |
| 14 | if ( ! current_user_can( 'view_health_statuses' ) ) { |
15 | 15 | wp_die( __( 'Sorry, you are not allowed to access the debug data.' ), '', 403 ); |
16 | 16 | } |
17 | 17 | |
diff --git a/wp-admin/site-health.php b/wp-admin/site-health.php
index 2c59626..4bcd927 100644
a
|
b
|
require_once( dirname( __FILE__ ) . '/admin.php' ); |
16 | 16 | |
17 | 17 | $title = __( 'Site Health Status' ); |
18 | 18 | |
19 | | if ( ! current_user_can( 'install_plugins' ) ) { |
| 19 | if ( ! current_user_can( 'view_health_statuses' ) ) { |
20 | 20 | wp_die( __( 'Sorry, you are not allowed to access site health information.' ), '', 403 ); |
21 | 21 | } |
22 | 22 | |
diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php
index 640ca6f..6b4550d 100644
a
|
b
|
function wp_maybe_grant_resume_extensions_caps( $allcaps ) { |
979 | 979 | return $allcaps; |
980 | 980 | } |
981 | 981 | |
| 982 | /** |
| 983 | * Filters the user capabilities to grant the 'view_health_statuses' capabilities as necessary. |
| 984 | * |
| 985 | * @since 5.2.0 |
| 986 | * |
| 987 | * @param bool[] $allcaps An array of all the user's capabilities. |
| 988 | * @return bool[] Filtered array of the user's capabilities. |
| 989 | */ |
| 990 | function wp_maybe_grant_site_health_caps( $allcaps ) { |
| 991 | |
| 992 | if ( ! empty( $allcaps['install_plugins'] ) ) { |
| 993 | $allcaps['view_health_statuses'] = true; |
| 994 | } |
| 995 | |
| 996 | return $allcaps; |
| 997 | } |
| 998 | |
982 | 999 | return; |
983 | 1000 | |
984 | 1001 | // Dummy gettext calls to get strings in the catalog. |
diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php
index ecdc87c..eb1c222 100644
a
|
b
|
add_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10, 3 ); |
580 | 580 | // Capabilities |
581 | 581 | add_filter( 'user_has_cap', 'wp_maybe_grant_install_languages_cap', 1 ); |
582 | 582 | add_filter( 'user_has_cap', 'wp_maybe_grant_resume_extensions_caps', 1 ); |
| 583 | add_filter( 'user_has_cap', 'wp_maybe_grant_site_health_caps', 1 ); |
583 | 584 | |
584 | 585 | unset( $filter, $action ); |