<?php
function drk_user_can_edit_permissions_check() {
    if ( ! current_user_can( 'edit_posts' ) && !current_user_can('edit_others_posts') ) {
        return new WP_Error( 'rest_forbidden', esc_html__( 'OMG you can not view private data.', 'my-text-domain' ), array( 'status' => 401 ) );
    }

    return true;
}