Bootstrap/Load: Fix missing object argument for singular capability checks and support capability tests overlooked in [44524].

See #44458.


git-svn-id: https://develop.svn.wordpress.org/trunk@44525 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Felix Arntz 2019-01-09 20:43:57 +00:00
parent fc37b1746e
commit ffd2a4bd16
2 changed files with 5 additions and 2 deletions

View File

@ -659,7 +659,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
$actions = array(
'network_active' => __( 'Network Active' ),
);
if ( ! $restrict_network_only && current_user_can( 'resume_plugin' ) && is_plugin_paused( $plugin_file ) ) {
if ( ! $restrict_network_only && current_user_can( 'resume_plugin', $plugin_file ) && is_plugin_paused( $plugin_file ) ) {
/* translators: %s: plugin name */
$actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Resume' ) . '</a>';
}
@ -672,7 +672,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
/* translators: %s: plugin name */
$actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
}
if ( current_user_can( 'resume_plugin' ) && is_plugin_paused( $plugin_file ) ) {
if ( current_user_can( 'resume_plugin', $plugin_file ) && is_plugin_paused( $plugin_file ) ) {
/* translators: %s: plugin name */
$actions['resume'] = '<a class="resume-link" href="' . wp_nonce_url( 'plugins.php?action=resume&amp;plugin=' . urlencode( $plugin_file ) . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'resume-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Resume %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Resume' ) . '</a>';
}

View File

@ -257,6 +257,7 @@ class Tests_User_Capabilities extends WP_UnitTestCase {
'export_others_personal_data' => array( 'administrator' ),
'erase_others_personal_data' => array( 'administrator' ),
'manage_privacy_options' => array( 'administrator' ),
'resume_themes' => array( 'administrator' ),
'edit_categories' => array( 'administrator', 'editor' ),
'delete_categories' => array( 'administrator', 'editor' ),
@ -296,6 +297,7 @@ class Tests_User_Capabilities extends WP_UnitTestCase {
'customize' => array( 'administrator' ),
'delete_site' => array( 'administrator' ),
'add_users' => array( 'administrator' ),
'resume_themes' => array( 'administrator' ),
'edit_categories' => array( 'administrator', 'editor' ),
'delete_categories' => array( 'administrator', 'editor' ),
@ -454,6 +456,7 @@ class Tests_User_Capabilities extends WP_UnitTestCase {
// Singular object meta capabilities (where an object ID is passed) are not tested:
$expected['activate_plugin'],
$expected['deactivate_plugin'],
$expected['resume_plugin'],
$expected['remove_user'],
$expected['promote_user'],
$expected['edit_user'],