Skip to content

Commit

Permalink
release: fixes
Browse files Browse the repository at this point in the history
- Enhanced security related to roles of users
  • Loading branch information
vytisbulkevicius authored Nov 2, 2023
2 parents d7da0cf + d893c7f commit 0c407b9
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions includes/feedzy-rss-feeds-feed-tweaks.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,15 +533,21 @@ function feedzy_current_user_can() {
return false;
}

add_filter(
'user_has_cap',
function ( $allcaps, $caps, $args, $user ) {
$capability = apply_filters( 'feedzy_admin_menu_capability', 'publish_posts' );
if ( ! empty( $allcaps[ $capability ] ) ) {
$allcaps['manage_options'] = ! empty( $allcaps[ $capability ] );
}
return $allcaps;
},
10,
4
);
/**
* Handle user capability.
*/
function feedzy_handle_user_cap() {
add_filter(
'user_has_cap',
function ( $allcaps, $caps, $args, $user ) {
$capability = apply_filters( 'feedzy_admin_menu_capability', 'publish_posts' );
if ( ! empty( $allcaps[ $capability ] ) ) {
$allcaps['manage_options'] = ! empty( $allcaps[ $capability ] );
}
return $allcaps;
},
10,
4
);
}
add_action( 'rest_api_init', 'feedzy_handle_user_cap' );

0 comments on commit 0c407b9

Please sign in to comment.