more manage_network_* caps, see #12109

git-svn-id: http://svn.automattic.com/wordpress/trunk@14003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
wpmuguru 2010-04-05 02:59:10 +00:00
parent b22d2ea457
commit e439ce17bd
2 changed files with 12 additions and 10 deletions

View File

@ -39,7 +39,7 @@ $_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate',
if ( !empty($action) ) { if ( !empty($action) ) {
$network_wide = false; $network_wide = false;
if ( ( isset( $_GET['networkwide'] ) || 'network-activate-selected' == $action ) && is_multisite() && is_super_admin() ) if ( ( isset( $_GET['networkwide'] ) || 'network-activate-selected' == $action ) && is_multisite() && current_user_can( 'manage_network_plugins' ) )
$network_wide = true; $network_wide = true;
switch ( $action ) { switch ( $action ) {
@ -378,7 +378,7 @@ $recently_activated = get_option('recently_activated', array());
$upgrade_plugins = array(); $upgrade_plugins = array();
$network_plugins = array(); $network_plugins = array();
$mustuse_plugins = $dropins_plugins = array(); $mustuse_plugins = $dropins_plugins = array();
if ( ! is_multisite() || ( is_multisite() && current_user_can('manage_network_plugins') ) ) { if ( ! is_multisite() || current_user_can('manage_network_plugins') ) {
if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) )
$mustuse_plugins = get_mu_plugins(); $mustuse_plugins = get_mu_plugins();
if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) )
@ -406,9 +406,11 @@ unset( $plugin_array_name );
foreach ( (array) $all_plugins as $plugin_file => $plugin_data) { foreach ( (array) $all_plugins as $plugin_file => $plugin_data) {
// Filter into individual sections // Filter into individual sections
if ( is_plugin_active_for_network($plugin_file) ) { if ( is_multisite() && is_network_only_plugin( $plugin_file ) && !current_user_can( 'manage_network_plugins' ) ) {
if ( is_super_admin() ) unset( $all_plugins[ $plugin_file ] );
$network_plugins[ $plugin_file ] = $plugin_data; continue;
} elseif ( is_plugin_active_for_network($plugin_file) ) {
$network_plugins[ $plugin_file ] = $plugin_data;
} elseif ( is_plugin_active($plugin_file) ) { } elseif ( is_plugin_active($plugin_file) ) {
$active_plugins[ $plugin_file ] = $plugin_data; $active_plugins[ $plugin_file ] = $plugin_data;
} else { } else {
@ -569,7 +571,7 @@ function print_plugins_table($plugins, $context = '') {
else else
$actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>'; $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
if ( is_multisite() && is_super_admin() ) if ( is_multisite() && current_user_can( 'manage_network_plugins' ) )
$actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>'; $actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>';
if ( current_user_can('delete_plugins') ) if ( current_user_can('delete_plugins') )

View File

@ -58,7 +58,7 @@ function use_ssl_preference($user) {
// Only allow super admins on multisite to edit every user. // Only allow super admins on multisite to edit every user.
if ( is_multisite() && ! is_super_admin() && $user_id != $current_user->ID && ! apply_filters( 'enable_edit_any_user_configuration', true ) ) if ( is_multisite() && ! current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && ! apply_filters( 'enable_edit_any_user_configuration', true ) )
wp_die( __( 'You do not have permission to edit this user.' ) ); wp_die( __( 'You do not have permission to edit this user.' ) );
// Execute confirmed email change. See send_confirmation_on_profile_email(). // Execute confirmed email change. See send_confirmation_on_profile_email().
@ -121,7 +121,7 @@ if ( !is_multisite() ) {
if ( $delete_role ) // stops users being added to current blog when they are edited if ( $delete_role ) // stops users being added to current blog when they are edited
delete_user_meta( $user_id, $blog_prefix . 'capabilities' ); delete_user_meta( $user_id, $blog_prefix . 'capabilities' );
if ( is_multisite() && is_super_admin() && !IS_PROFILE_PAGE ) if ( is_multisite() && !IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) )
empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id ); empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id );
} }
@ -141,7 +141,7 @@ if ( !current_user_can('edit_user', $user_id) )
include ('admin-header.php'); include ('admin-header.php');
?> ?>
<?php if ( !IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) ) { ?> <?php if ( !IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) && current_user_can( 'manage_network_options' ) ) { ?>
<div class="updated"><p><strong><?php _e('Important:'); ?></strong> <?php _e('This user has super admin privileges.'); ?></p></div> <div class="updated"><p><strong><?php _e('Important:'); ?></strong> <?php _e('This user has super admin privileges.'); ?></p></div>
<?php } ?> <?php } ?>
<?php if ( isset($_GET['updated']) ) : ?> <?php if ( isset($_GET['updated']) ) : ?>
@ -235,7 +235,7 @@ else
echo '<option value="" selected="selected">' . __('&mdash; No role for this blog &mdash;') . '</option>'; echo '<option value="" selected="selected">' . __('&mdash; No role for this blog &mdash;') . '</option>';
?> ?>
</select> </select>
<?php if ( is_multisite() && is_super_admin() ) { ?> <?php if ( is_multisite() && current_user_can( 'manage_network_options' ) ) { ?>
<p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.'); ?></label></p> <p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.'); ?></label></p>
<?php } ?> <?php } ?>
</td></tr> </td></tr>