Privacy: Un-map privacy capabilities to make them available to be assigned for custom roles:

* `erase_others_personal_data`
* `export_others_personal_data`
* `manage_privacy_options`

Previously mapped to `manage_options` or `manage_network` (on Multisite), these are now added to the Administrator role separately.

Additionally, `manage_privacy_options` is added to the Editor role.

Props garrett-eclipse, xkon, pbiron, desrosj, johnbillion, flixos90, juliobox, lakenh, Ov3rfly, ianatkins.
Fixes #44176.

git-svn-id: https://develop.svn.wordpress.org/trunk@47269 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-02-11 18:34:08 +00:00
parent 49b145c23f
commit 0911aecf36
6 changed files with 246 additions and 203 deletions
+22
View File
@@ -695,6 +695,7 @@ function populate_roles() {
populate_roles_270();
populate_roles_280();
populate_roles_300();
populate_roles_540();
}
/**
@@ -923,6 +924,27 @@ function populate_roles_300() {
}
}
/**
* Create and modify WordPress roles for WordPress 5.4.0.
*
* @since 5.4.0
*/
function populate_roles_540() {
// Add the privacy caps to the Administrators.
$role = get_role( 'administrator' );
if ( ! empty( $role ) ) {
$role->add_cap( 'export_others_personal_data' );
$role->add_cap( 'erase_others_personal_data' );
$role->add_cap( 'manage_privacy_options' );
}
$role = get_role( 'editor' );
if ( ! empty( $role ) ) {
$role->add_cap( 'manage_privacy_options' );
}
}
if ( ! function_exists( 'install_network' ) ) :
/**
* Install Network.