Restrict Custom Post Type per role in Dashboard

I would like to set up some restrictions on how some roles can access given posts to edit in Dashboard. I have a custom post type affiliates having 2 nested levels.

Custom Role User Editor should be able to edit under a level all posts but the normal editor should have access just on items defined by a custom field relation user - post_id

Is there an easy way to implement this

Topic user-roles capabilities custom-post-types Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.