Multisite: Introduce a setup_network capability for setting up multisite.

`setup_network` is a new meta capability that brings more granular control over the permissions to setup a multisite environment. In a non-multisite environment it falls back to `manage_options` while in a multisite it falls back to `manage_network_options`. The introduction of this capability furthermore allows replacing an `is_super_admin()` check.

Props ashokkumar24 for the original patch.
Fixes #39206. See #37616.


git-svn-id: https://develop.svn.wordpress.org/trunk@40390 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Felix Arntz
2017-04-07 12:52:24 +00:00
parent ca0aa133ff
commit 3ca0673036
5 changed files with 12 additions and 3 deletions
+7
View File
@@ -480,6 +480,13 @@ function map_meta_cap( $cap, $user_id ) {
case 'manage_network_options':
$caps[] = $cap;
break;
case 'setup_network':
if ( is_multisite() ) {
$caps[] = 'manage_network_options';
} else {
$caps[] = 'manage_options';
}
break;
default:
// Handle meta capabilities for custom post types.
global $post_type_meta_caps;