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) ) {
$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;
switch ( $action ) {
@ -378,7 +378,7 @@ $recently_activated = get_option('recently_activated', array());
$upgrade_plugins = array();
$network_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' ) )
$mustuse_plugins = get_mu_plugins();
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) {
// Filter into individual sections
if ( is_plugin_active_for_network($plugin_file) ) {
if ( is_super_admin() )
$network_plugins[ $plugin_file ] = $plugin_data;
if ( is_multisite() && is_network_only_plugin( $plugin_file ) && !current_user_can( 'manage_network_plugins' ) ) {
unset( $all_plugins[ $plugin_file ] );
continue;
} elseif ( is_plugin_active_for_network($plugin_file) ) {
$network_plugins[ $plugin_file ] = $plugin_data;
} elseif ( is_plugin_active($plugin_file) ) {
$active_plugins[ $plugin_file ] = $plugin_data;
} else {
@ -569,7 +571,7 @@ function print_plugins_table($plugins, $context = '') {
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>';
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>';
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.
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.' ) );
// 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
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 );
}
@ -141,7 +141,7 @@ if ( !current_user_can('edit_user', $user_id) )
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>
<?php } ?>
<?php if ( isset($_GET['updated']) ) : ?>
@ -235,7 +235,7 @@ else
echo '<option value="" selected="selected">' . __('&mdash; No role for this blog &mdash;') . '</option>';
?>
</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>
<?php } ?>
</td></tr>