<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[45507] trunk: Site health: Introduce `view_site_health_checks` capability.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/45507">45507</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/45507","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>peterwilsoncc</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-06-10 07:41:12 +0000 (Mon, 10 Jun 2019)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Site health: Introduce `view_site_health_checks` capability.
Introduces the faux primitive capability `view_site_health_checks` available to single site admins and multisite super-admin to view the site health page within the admin.
The capability is mapped to the `install_plugins` capability without being dependent on the file system being writable. This fixes a bug where the feature couldn't be used by sites unable to write to the file system or managed through version control.
The capability is granted on the `user_has_cap` filter.
Props birgire, Clorith, palmiak, peterwilsoncc, spacedmonkey.
Fixes <a href="https://core.trac.wordpress.org/ticket/46957">#46957</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesajaxactionsphp">trunk/src/wp-admin/includes/ajax-actions.php</a></li>
<li><a href="#trunksrcwpadminmenuphp">trunk/src/wp-admin/menu.php</a></li>
<li><a href="#trunksrcwpadminsitehealthinfophp">trunk/src/wp-admin/site-health-info.php</a></li>
<li><a href="#trunksrcwpadminsitehealthphp">trunk/src/wp-admin/site-health.php</a></li>
<li><a href="#trunksrcwpincludescapabilitiesphp">trunk/src/wp-includes/capabilities.php</a></li>
<li><a href="#trunksrcwpincludesdefaultfiltersphp">trunk/src/wp-includes/default-filters.php</a></li>
<li><a href="#trunktestsphpunittestsusercapabilitiesphp">trunk/tests/phpunit/tests/user/capabilities.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesajaxactionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/ajax-actions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/ajax-actions.php 2019-06-09 15:47:43 UTC (rev 45506)
+++ trunk/src/wp-admin/includes/ajax-actions.php 2019-06-10 07:41:12 UTC (rev 45507)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4869,7 +4869,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_ajax_health_check_dotorg_communication() {
</span><span class="cx" style="display: block; padding: 0 10px"> check_ajax_referer( 'health-check-site-status' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! current_user_can( 'install_plugins' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! current_user_can( 'view_site_health_checks' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_send_json_error();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4889,7 +4889,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_ajax_health_check_is_in_debug_mode() {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_verify_nonce( 'health-check-site-status' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! current_user_can( 'install_plugins' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! current_user_can( 'view_site_health_checks' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_send_json_error();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4909,7 +4909,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_ajax_health_check_background_updates() {
</span><span class="cx" style="display: block; padding: 0 10px"> check_ajax_referer( 'health-check-site-status' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! current_user_can( 'install_plugins' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! current_user_can( 'view_site_health_checks' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_send_json_error();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4930,7 +4930,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_ajax_health_check_loopback_requests() {
</span><span class="cx" style="display: block; padding: 0 10px"> check_ajax_referer( 'health-check-site-status' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! current_user_can( 'install_plugins' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! current_user_can( 'view_site_health_checks' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_send_json_error();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4950,7 +4950,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_ajax_health_check_site_status_result() {
</span><span class="cx" style="display: block; padding: 0 10px"> check_ajax_referer( 'health-check-site-status-result' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! current_user_can( 'install_plugins' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! current_user_can( 'view_site_health_checks' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_send_json_error();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4967,7 +4967,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_ajax_health_check_get_sizes() {
</span><span class="cx" style="display: block; padding: 0 10px"> check_ajax_referer( 'health-check-site-status-result' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! current_user_can( 'install_plugins' ) || is_multisite() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! current_user_can( 'view_site_health_checks' ) || is_multisite() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_send_json_error();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpadminmenuphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/menu.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/menu.php 2019-06-09 15:47:43 UTC (rev 45506)
+++ trunk/src/wp-admin/menu.php 2019-06-10 07:41:12 UTC (rev 45507)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -263,7 +263,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $submenu['tools.php'][5] = array( __( 'Available Tools' ), 'edit_posts', 'tools.php' );
</span><span class="cx" style="display: block; padding: 0 10px"> $submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' );
</span><span class="cx" style="display: block; padding: 0 10px"> $submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $submenu['tools.php'][20] = array( __( 'Site Health' ), 'install_plugins', 'site-health.php' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $submenu['tools.php'][20] = array( __( 'Site Health' ), 'view_site_health_checks', 'site-health.php' );
</ins><span class="cx" style="display: block; padding: 0 10px"> $submenu['tools.php'][25] = array( __( 'Export Personal Data' ), 'export_others_personal_data', 'export-personal-data.php' );
</span><span class="cx" style="display: block; padding: 0 10px"> $submenu['tools.php'][30] = array( __( 'Erase Personal Data' ), 'erase_others_personal_data', 'erase-personal-data.php' );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_multisite() && ! is_main_site() ) {
</span></span></pre></div>
<a id="trunksrcwpadminsitehealthinfophp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/site-health-info.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/site-health-info.php 2019-06-09 15:47:43 UTC (rev 45506)
+++ trunk/src/wp-admin/site-health-info.php 2019-06-10 07:41:12 UTC (rev 45507)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,7 +11,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $title = __( 'Site Health Info' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( ! current_user_can( 'install_plugins' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+if ( ! current_user_can( 'view_site_health_checks' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_die( __( 'Sorry, you are not allowed to access the debug data.' ), '', 403 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpadminsitehealthphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/site-health.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/site-health.php 2019-06-09 15:47:43 UTC (rev 45506)
+++ trunk/src/wp-admin/site-health.php 2019-06-10 07:41:12 UTC (rev 45507)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,7 +16,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $title = __( 'Site Health Status' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( ! current_user_can( 'install_plugins' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+if ( ! current_user_can( 'view_site_health_checks' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_die( __( 'Sorry, you are not allowed to access site health information.' ), '', 403 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludescapabilitiesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/capabilities.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/capabilities.php 2019-06-09 15:47:43 UTC (rev 45506)
+++ trunk/src/wp-includes/capabilities.php 2019-06-10 07:41:12 UTC (rev 45507)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1025,6 +1025,31 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $allcaps;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Filters the user capabilities to grant the 'view_site_health_checks' capabilities as necessary.
+ *
+ * @since 5.2.2
+ *
+ * @param bool[] $allcaps An array of all the user's capabilities.
+ * @param string[] $caps Required primitive capabilities for the requested capability.
+ * @param array $args {
+ * Arguments that accompany the requested capability check.
+ *
+ * @type string $0 Requested capability.
+ * @type int $1 Concerned user ID.
+ * @type mixed ...$2 Optional second and further parameters, typically object ID.
+ * }
+ * @param WP_User $user The user object.
+ * @return bool[] Filtered array of the user's capabilities.
+ */
+function wp_maybe_grant_site_health_caps( $allcaps, $caps, $args, $user ) {
+ if ( ! empty( $allcaps['install_plugins'] ) && ( ! is_multisite() || is_super_admin( $user->ID ) ) ) {
+ $allcaps['view_site_health_checks'] = true;
+ }
+
+ return $allcaps;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Dummy gettext calls to get strings in the catalog.
</span></span></pre></div>
<a id="trunksrcwpincludesdefaultfiltersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/default-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/default-filters.php 2019-06-09 15:47:43 UTC (rev 45506)
+++ trunk/src/wp-includes/default-filters.php 2019-06-10 07:41:12 UTC (rev 45507)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -580,5 +580,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Capabilities
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'user_has_cap', 'wp_maybe_grant_install_languages_cap', 1 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'user_has_cap', 'wp_maybe_grant_resume_extensions_caps', 1 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_filter( 'user_has_cap', 'wp_maybe_grant_site_health_caps', 1, 4 );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $filter, $action );
</span></span></pre></div>
<a id="trunktestsphpunittestsusercapabilitiesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/user/capabilities.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/user/capabilities.php 2019-06-09 15:47:43 UTC (rev 45506)
+++ trunk/tests/phpunit/tests/user/capabilities.php 2019-06-10 07:41:12 UTC (rev 45507)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -76,79 +76,80 @@
</span><span class="cx" style="display: block; padding: 0 10px"> final private function _getSingleSitePrimitiveCaps() {
</span><span class="cx" style="display: block; padding: 0 10px"> return array(
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'unfiltered_html' => array( 'administrator', 'editor' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'unfiltered_html' => array( 'administrator', 'editor' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'activate_plugins' => array( 'administrator' ),
- 'create_users' => array( 'administrator' ),
- 'delete_plugins' => array( 'administrator' ),
- 'delete_themes' => array( 'administrator' ),
- 'delete_users' => array( 'administrator' ),
- 'edit_files' => array( 'administrator' ),
- 'edit_plugins' => array( 'administrator' ),
- 'edit_themes' => array( 'administrator' ),
- 'edit_users' => array( 'administrator' ),
- 'install_plugins' => array( 'administrator' ),
- 'install_themes' => array( 'administrator' ),
- 'update_core' => array( 'administrator' ),
- 'update_plugins' => array( 'administrator' ),
- 'update_themes' => array( 'administrator' ),
- 'edit_theme_options' => array( 'administrator' ),
- 'export' => array( 'administrator' ),
- 'import' => array( 'administrator' ),
- 'list_users' => array( 'administrator' ),
- 'manage_options' => array( 'administrator' ),
- 'promote_users' => array( 'administrator' ),
- 'remove_users' => array( 'administrator' ),
- 'switch_themes' => array( 'administrator' ),
- 'edit_dashboard' => array( 'administrator' ),
- 'resume_plugins' => array( 'administrator' ),
- 'resume_themes' => array( 'administrator' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'activate_plugins' => array( 'administrator' ),
+ 'create_users' => array( 'administrator' ),
+ 'delete_plugins' => array( 'administrator' ),
+ 'delete_themes' => array( 'administrator' ),
+ 'delete_users' => array( 'administrator' ),
+ 'edit_files' => array( 'administrator' ),
+ 'edit_plugins' => array( 'administrator' ),
+ 'edit_themes' => array( 'administrator' ),
+ 'edit_users' => array( 'administrator' ),
+ 'install_plugins' => array( 'administrator' ),
+ 'install_themes' => array( 'administrator' ),
+ 'update_core' => array( 'administrator' ),
+ 'update_plugins' => array( 'administrator' ),
+ 'update_themes' => array( 'administrator' ),
+ 'edit_theme_options' => array( 'administrator' ),
+ 'export' => array( 'administrator' ),
+ 'import' => array( 'administrator' ),
+ 'list_users' => array( 'administrator' ),
+ 'manage_options' => array( 'administrator' ),
+ 'promote_users' => array( 'administrator' ),
+ 'remove_users' => array( 'administrator' ),
+ 'switch_themes' => array( 'administrator' ),
+ 'edit_dashboard' => array( 'administrator' ),
+ 'resume_plugins' => array( 'administrator' ),
+ 'resume_themes' => array( 'administrator' ),
+ 'view_site_health_checks' => array( 'administrator' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'moderate_comments' => array( 'administrator', 'editor' ),
- 'manage_categories' => array( 'administrator', 'editor' ),
- 'edit_others_posts' => array( 'administrator', 'editor' ),
- 'edit_pages' => array( 'administrator', 'editor' ),
- 'edit_others_pages' => array( 'administrator', 'editor' ),
- 'edit_published_pages' => array( 'administrator', 'editor' ),
- 'publish_pages' => array( 'administrator', 'editor' ),
- 'delete_pages' => array( 'administrator', 'editor' ),
- 'delete_others_pages' => array( 'administrator', 'editor' ),
- 'delete_published_pages' => array( 'administrator', 'editor' ),
- 'delete_others_posts' => array( 'administrator', 'editor' ),
- 'delete_private_posts' => array( 'administrator', 'editor' ),
- 'edit_private_posts' => array( 'administrator', 'editor' ),
- 'read_private_posts' => array( 'administrator', 'editor' ),
- 'delete_private_pages' => array( 'administrator', 'editor' ),
- 'edit_private_pages' => array( 'administrator', 'editor' ),
- 'read_private_pages' => array( 'administrator', 'editor' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'moderate_comments' => array( 'administrator', 'editor' ),
+ 'manage_categories' => array( 'administrator', 'editor' ),
+ 'edit_others_posts' => array( 'administrator', 'editor' ),
+ 'edit_pages' => array( 'administrator', 'editor' ),
+ 'edit_others_pages' => array( 'administrator', 'editor' ),
+ 'edit_published_pages' => array( 'administrator', 'editor' ),
+ 'publish_pages' => array( 'administrator', 'editor' ),
+ 'delete_pages' => array( 'administrator', 'editor' ),
+ 'delete_others_pages' => array( 'administrator', 'editor' ),
+ 'delete_published_pages' => array( 'administrator', 'editor' ),
+ 'delete_others_posts' => array( 'administrator', 'editor' ),
+ 'delete_private_posts' => array( 'administrator', 'editor' ),
+ 'edit_private_posts' => array( 'administrator', 'editor' ),
+ 'read_private_posts' => array( 'administrator', 'editor' ),
+ 'delete_private_pages' => array( 'administrator', 'editor' ),
+ 'edit_private_pages' => array( 'administrator', 'editor' ),
+ 'read_private_pages' => array( 'administrator', 'editor' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'edit_published_posts' => array( 'administrator', 'editor', 'author' ),
- 'upload_files' => array( 'administrator', 'editor', 'author' ),
- 'publish_posts' => array( 'administrator', 'editor', 'author' ),
- 'delete_published_posts' => array( 'administrator', 'editor', 'author' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'edit_published_posts' => array( 'administrator', 'editor', 'author' ),
+ 'upload_files' => array( 'administrator', 'editor', 'author' ),
+ 'publish_posts' => array( 'administrator', 'editor', 'author' ),
+ 'delete_published_posts' => array( 'administrator', 'editor', 'author' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'edit_posts' => array( 'administrator', 'editor', 'author', 'contributor' ),
- 'delete_posts' => array( 'administrator', 'editor', 'author', 'contributor' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'edit_posts' => array( 'administrator', 'editor', 'author', 'contributor' ),
+ 'delete_posts' => array( 'administrator', 'editor', 'author', 'contributor' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'read' => array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'read' => array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'level_10' => array( 'administrator' ),
- 'level_9' => array( 'administrator' ),
- 'level_8' => array( 'administrator' ),
- 'level_7' => array( 'administrator', 'editor' ),
- 'level_6' => array( 'administrator', 'editor' ),
- 'level_5' => array( 'administrator', 'editor' ),
- 'level_4' => array( 'administrator', 'editor' ),
- 'level_3' => array( 'administrator', 'editor' ),
- 'level_2' => array( 'administrator', 'editor', 'author' ),
- 'level_1' => array( 'administrator', 'editor', 'author', 'contributor' ),
- 'level_0' => array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'level_10' => array( 'administrator' ),
+ 'level_9' => array( 'administrator' ),
+ 'level_8' => array( 'administrator' ),
+ 'level_7' => array( 'administrator', 'editor' ),
+ 'level_6' => array( 'administrator', 'editor' ),
+ 'level_5' => array( 'administrator', 'editor' ),
+ 'level_4' => array( 'administrator', 'editor' ),
+ 'level_3' => array( 'administrator', 'editor' ),
+ 'level_2' => array( 'administrator', 'editor', 'author' ),
+ 'level_1' => array( 'administrator', 'editor', 'author', 'contributor' ),
+ 'level_0' => array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'administrator' => array( 'administrator' ),
- 'editor' => array( 'editor' ),
- 'author' => array( 'author' ),
- 'contributor' => array( 'contributor' ),
- 'subscriber' => array( 'subscriber' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'administrator' => array( 'administrator' ),
+ 'editor' => array( 'editor' ),
+ 'author' => array( 'author' ),
+ 'contributor' => array( 'contributor' ),
+ 'subscriber' => array( 'subscriber' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -157,80 +158,81 @@
</span><span class="cx" style="display: block; padding: 0 10px"> final private function _getMultiSitePrimitiveCaps() {
</span><span class="cx" style="display: block; padding: 0 10px"> return array(
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'unfiltered_html' => array(),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'unfiltered_html' => array(),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'activate_plugins' => array(),
- 'create_users' => array(),
- 'delete_plugins' => array(),
- 'delete_themes' => array(),
- 'delete_users' => array(),
- 'edit_files' => array(),
- 'edit_plugins' => array(),
- 'edit_themes' => array(),
- 'edit_users' => array(),
- 'install_plugins' => array(),
- 'install_themes' => array(),
- 'update_core' => array(),
- 'update_plugins' => array(),
- 'update_themes' => array(),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'activate_plugins' => array(),
+ 'create_users' => array(),
+ 'delete_plugins' => array(),
+ 'delete_themes' => array(),
+ 'delete_users' => array(),
+ 'edit_files' => array(),
+ 'edit_plugins' => array(),
+ 'edit_themes' => array(),
+ 'edit_users' => array(),
+ 'install_plugins' => array(),
+ 'install_themes' => array(),
+ 'update_core' => array(),
+ 'update_plugins' => array(),
+ 'update_themes' => array(),
+ 'view_site_health_checks' => array(),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'edit_theme_options' => array( 'administrator' ),
- 'export' => array( 'administrator' ),
- 'import' => array( 'administrator' ),
- 'list_users' => array( 'administrator' ),
- 'manage_options' => array( 'administrator' ),
- 'promote_users' => array( 'administrator' ),
- 'remove_users' => array( 'administrator' ),
- 'switch_themes' => array( 'administrator' ),
- 'edit_dashboard' => array( 'administrator' ),
- 'resume_plugins' => array( 'administrator' ),
- 'resume_themes' => array( 'administrator' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'edit_theme_options' => array( 'administrator' ),
+ 'export' => array( 'administrator' ),
+ 'import' => array( 'administrator' ),
+ 'list_users' => array( 'administrator' ),
+ 'manage_options' => array( 'administrator' ),
+ 'promote_users' => array( 'administrator' ),
+ 'remove_users' => array( 'administrator' ),
+ 'switch_themes' => array( 'administrator' ),
+ 'edit_dashboard' => array( 'administrator' ),
+ 'resume_plugins' => array( 'administrator' ),
+ 'resume_themes' => array( 'administrator' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'moderate_comments' => array( 'administrator', 'editor' ),
- 'manage_categories' => array( 'administrator', 'editor' ),
- 'edit_others_posts' => array( 'administrator', 'editor' ),
- 'edit_pages' => array( 'administrator', 'editor' ),
- 'edit_others_pages' => array( 'administrator', 'editor' ),
- 'edit_published_pages' => array( 'administrator', 'editor' ),
- 'publish_pages' => array( 'administrator', 'editor' ),
- 'delete_pages' => array( 'administrator', 'editor' ),
- 'delete_others_pages' => array( 'administrator', 'editor' ),
- 'delete_published_pages' => array( 'administrator', 'editor' ),
- 'delete_others_posts' => array( 'administrator', 'editor' ),
- 'delete_private_posts' => array( 'administrator', 'editor' ),
- 'edit_private_posts' => array( 'administrator', 'editor' ),
- 'read_private_posts' => array( 'administrator', 'editor' ),
- 'delete_private_pages' => array( 'administrator', 'editor' ),
- 'edit_private_pages' => array( 'administrator', 'editor' ),
- 'read_private_pages' => array( 'administrator', 'editor' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'moderate_comments' => array( 'administrator', 'editor' ),
+ 'manage_categories' => array( 'administrator', 'editor' ),
+ 'edit_others_posts' => array( 'administrator', 'editor' ),
+ 'edit_pages' => array( 'administrator', 'editor' ),
+ 'edit_others_pages' => array( 'administrator', 'editor' ),
+ 'edit_published_pages' => array( 'administrator', 'editor' ),
+ 'publish_pages' => array( 'administrator', 'editor' ),
+ 'delete_pages' => array( 'administrator', 'editor' ),
+ 'delete_others_pages' => array( 'administrator', 'editor' ),
+ 'delete_published_pages' => array( 'administrator', 'editor' ),
+ 'delete_others_posts' => array( 'administrator', 'editor' ),
+ 'delete_private_posts' => array( 'administrator', 'editor' ),
+ 'edit_private_posts' => array( 'administrator', 'editor' ),
+ 'read_private_posts' => array( 'administrator', 'editor' ),
+ 'delete_private_pages' => array( 'administrator', 'editor' ),
+ 'edit_private_pages' => array( 'administrator', 'editor' ),
+ 'read_private_pages' => array( 'administrator', 'editor' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'edit_published_posts' => array( 'administrator', 'editor', 'author' ),
- 'upload_files' => array( 'administrator', 'editor', 'author' ),
- 'publish_posts' => array( 'administrator', 'editor', 'author' ),
- 'delete_published_posts' => array( 'administrator', 'editor', 'author' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'edit_published_posts' => array( 'administrator', 'editor', 'author' ),
+ 'upload_files' => array( 'administrator', 'editor', 'author' ),
+ 'publish_posts' => array( 'administrator', 'editor', 'author' ),
+ 'delete_published_posts' => array( 'administrator', 'editor', 'author' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'edit_posts' => array( 'administrator', 'editor', 'author', 'contributor' ),
- 'delete_posts' => array( 'administrator', 'editor', 'author', 'contributor' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'edit_posts' => array( 'administrator', 'editor', 'author', 'contributor' ),
+ 'delete_posts' => array( 'administrator', 'editor', 'author', 'contributor' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'read' => array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'read' => array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'level_10' => array( 'administrator' ),
- 'level_9' => array( 'administrator' ),
- 'level_8' => array( 'administrator' ),
- 'level_7' => array( 'administrator', 'editor' ),
- 'level_6' => array( 'administrator', 'editor' ),
- 'level_5' => array( 'administrator', 'editor' ),
- 'level_4' => array( 'administrator', 'editor' ),
- 'level_3' => array( 'administrator', 'editor' ),
- 'level_2' => array( 'administrator', 'editor', 'author' ),
- 'level_1' => array( 'administrator', 'editor', 'author', 'contributor' ),
- 'level_0' => array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'level_10' => array( 'administrator' ),
+ 'level_9' => array( 'administrator' ),
+ 'level_8' => array( 'administrator' ),
+ 'level_7' => array( 'administrator', 'editor' ),
+ 'level_6' => array( 'administrator', 'editor' ),
+ 'level_5' => array( 'administrator', 'editor' ),
+ 'level_4' => array( 'administrator', 'editor' ),
+ 'level_3' => array( 'administrator', 'editor' ),
+ 'level_2' => array( 'administrator', 'editor', 'author' ),
+ 'level_1' => array( 'administrator', 'editor', 'author', 'contributor' ),
+ 'level_0' => array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'administrator' => array( 'administrator' ),
- 'editor' => array( 'editor' ),
- 'author' => array( 'author' ),
- 'contributor' => array( 'contributor' ),
- 'subscriber' => array( 'subscriber' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'administrator' => array( 'administrator' ),
+ 'editor' => array( 'editor' ),
+ 'author' => array( 'author' ),
+ 'contributor' => array( 'contributor' ),
+ 'subscriber' => array( 'subscriber' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -397,9 +399,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $actual['author'],
</span><span class="cx" style="display: block; padding: 0 10px"> $actual['subscriber'],
</span><span class="cx" style="display: block; padding: 0 10px"> $actual['contributor'],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // the following two are granted via `user_has_cap`:
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // The following are granted via `user_has_cap`:
</ins><span class="cx" style="display: block; padding: 0 10px"> $actual['resume_plugins'],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $actual['resume_themes']
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $actual['resume_themes'],
+ $actual['view_site_health_checks']
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> unset(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1200,7 +1203,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( $contributor->has_cap( 'publish_post', $post ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( $contributor->has_cap( 'edit_post', $post ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( $contributor->has_cap( 'delete_post', $post ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEquals( $status === 'publish', $contributor->has_cap( 'read_post', $post ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEquals( 'publish' === $status, $contributor->has_cap( 'read_post', $post ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre>
</div>
</div>
</body>
</html>